Ejemplo n.º 1
0
        public SolutionBindingOperation(IServiceProvider serviceProvider, ConnectionInformation connection, string sonarQubeProjectKey)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            if (string.IsNullOrWhiteSpace(sonarQubeProjectKey))
            {
                throw new ArgumentNullException(nameof(sonarQubeProjectKey));
            }

            this.serviceProvider     = serviceProvider;
            this.connection          = connection;
            this.sonarQubeProjectKey = sonarQubeProjectKey;

            this.projectSystem = this.serviceProvider.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.sourceControlledFileSystem = this.serviceProvider.GetService <ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();
        }
        public BindingWorkflow(IHost host, BindCommandArgs bindingArgs)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (bindingArgs == null)
            {
                throw new ArgumentNullException(nameof(bindingArgs));
            }
            Debug.Assert(bindingArgs.ProjectKey != null);
            Debug.Assert(bindingArgs.ProjectName != null);
            Debug.Assert(bindingArgs.Connection != null);

            this.host          = host;
            this.bindingArgs   = bindingArgs;
            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.solutionBindingOperation = new SolutionBindingOperation(
                this.host,
                this.bindingArgs.Connection,
                this.bindingArgs.ProjectKey);
        }
        public SolutionBindingOperation(IServiceProvider serviceProvider, ConnectionInformation connection, string sonarQubeProjectKey)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            if (string.IsNullOrWhiteSpace(sonarQubeProjectKey))
            {
                throw new ArgumentNullException(nameof(sonarQubeProjectKey));
            }

            this.serviceProvider = serviceProvider;
            this.connection = connection;
            this.sonarQubeProjectKey = sonarQubeProjectKey;

            this.projectSystem = this.serviceProvider.GetService<IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.sourceControlledFileSystem = this.serviceProvider.GetService<ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();
        }
Ejemplo n.º 4
0
        public BindingProcessImpl(IHost host,
                                  BindCommandArgs bindingArgs,
                                  ISolutionBindingOperation solutionBindingOperation,
                                  INuGetBindingOperation nugetBindingOperation,
                                  IUnboundProjectFinder unboundProjectFinder,
                                  IBindingConfigProvider bindingConfigProvider,
                                  SonarLintMode bindingMode,
                                  bool isFirstBinding = false)
        {
            this.host        = host ?? throw new ArgumentNullException(nameof(host));
            this.bindingArgs = bindingArgs ?? throw new ArgumentNullException(nameof(bindingArgs));
            this.solutionBindingOperation = solutionBindingOperation ?? throw new ArgumentNullException(nameof(solutionBindingOperation));
            this.NuGetBindingOperation    = nugetBindingOperation ?? throw new ArgumentNullException(nameof(nugetBindingOperation));
            this.unboundProjectFinder     = unboundProjectFinder ?? throw new ArgumentNullException(nameof(unboundProjectFinder));
            this.bindingConfigProvider    = bindingConfigProvider ?? throw new ArgumentNullException(nameof(bindingConfigProvider));
            this.bindingMode = bindingMode;

            Debug.Assert(bindingArgs.ProjectKey != null);
            Debug.Assert(bindingArgs.ProjectName != null);
            Debug.Assert(bindingArgs.Connection != null);

            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.InternalState = new BindingProcessState(isFirstBinding);
        }
        public BindingWorkflow(IHost host, ConnectionInformation connectionInformation, SonarQubeProject project)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (connectionInformation == null)
            {
                throw new ArgumentNullException(nameof(connectionInformation));
            }

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            this.host = host;
            this.connectionInformation = connectionInformation;
            this.project       = project;
            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.solutionBindingOperation = new SolutionBindingOperation(
                this.host,
                this.connectionInformation,
                this.project.Key);
        }
        internal SolutionBindingOperation(IServiceProvider serviceProvider,
                                          ConnectionInformation connection,
                                          string projectKey,
                                          string projectName,
                                          SonarLintMode bindingMode,
                                          ILogger logger,
                                          IFileSystem fileSystem)
        {
            if (string.IsNullOrWhiteSpace(projectKey))
            {
                throw new ArgumentNullException(nameof(projectKey));
            }

            bindingMode.ThrowIfNotConnected();

            this.serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            this.connection      = connection ?? throw new ArgumentNullException(nameof(connection));
            this.logger          = logger ?? throw new ArgumentNullException(nameof(logger));
            this.fileSystem      = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));

            this.projectKey  = projectKey;
            this.projectName = projectName;
            this.bindingMode = bindingMode;

            this.projectSystem = this.serviceProvider.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.sourceControlledFileSystem = this.serviceProvider.GetService <ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();
        }
        public BindingWorkflow(IHost host, ConnectionInformation connectionInformation, ProjectInformation project)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (connectionInformation == null)
            {
                throw new ArgumentNullException(nameof(connectionInformation));
            }

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            this.host = host;
            this.connectionInformation = connectionInformation;
            this.project = project;
            this.projectSystem = this.host.GetService<IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.solutionBindingOperation = new SolutionBindingOperation(
                    this.host,
                    this.connectionInformation,
                    this.project.Key);
        }
Ejemplo n.º 8
0
        public SolutionBindingOperation(IServiceProvider serviceProvider, ConnectionInformation connection, string ProjectKey, SonarLintMode bindingMode)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (connection == null)
            {
                throw new ArgumentNullException(nameof(connection));
            }

            if (string.IsNullOrWhiteSpace(ProjectKey))
            {
                throw new ArgumentNullException(nameof(ProjectKey));
            }

            bindingMode.ThrowIfNotConnected();

            this.serviceProvider = serviceProvider;
            this.connection      = connection;
            this.ProjectKey      = ProjectKey;

            this.projectSystem = this.serviceProvider.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.sourceControlledFileSystem = this.serviceProvider.GetService <ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();

            this.bindingMode = bindingMode;
        }
 public CSharpVBAdditionalFileReferenceChecker(IServiceProvider serviceProvider)
 {
     if (serviceProvider == null)
     {
         throw new ArgumentNullException(nameof(serviceProvider));
     }
     projectSystemHelper = serviceProvider.GetService <IProjectSystemHelper>();
     projectSystemHelper.AssertLocalServiceIsNotNull();
 }
        public ProjectKindTestProjectIndicator(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            projectSystem = serviceProvider.GetService <IProjectSystemHelper>();
            projectSystem.AssertLocalServiceIsNotNull();
        }
        public ProjectPropertyManager(IHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.projectSystem = host.GetService<IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();
        }
Ejemplo n.º 12
0
        public ProjectPropertyManager(IHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.projectSystem = host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();
        }
        public ConnectionWorkflow(IHost host, ICommand parentCommand)
        {
            this.host          = host ?? throw new ArgumentNullException(nameof(host));
            this.parentCommand = parentCommand ?? throw new ArgumentNullException(nameof(parentCommand));

            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.credentialStore = this.host.GetService <ICredentialStoreService>();

            this.testProjectRegexSetter = this.host.GetService <ITestProjectRegexSetter>();
            testProjectRegexSetter.AssertLocalServiceIsNotNull();
        }
        public ProjectSystemFilter(IHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.projectSystem = host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.propertyManager = host.GetMefService <IProjectPropertyManager>();
            Debug.Assert(this.propertyManager != null, $"Failed to get {nameof(IProjectPropertyManager)}");
        }
        internal /* for testing */ static void AddAdditionalFileToProject(IProjectSystemHelper projectSystem, Project project, string filePath)
        {
            try
            {
                projectSystem.AddFileToProject(project, filePath, Constants.AdditionalFilesItemTypeName);
            }
            catch (Exception ex) when(!ErrorHandler.IsCriticalException(ex))
            {
                var message = string.Format(BindingStrings.CSharpVB_FailedToAddSonarLintXml, project.FileName, ex.Message);

                throw new SonarLintException(message, ex);
            }
        }
Ejemplo n.º 16
0
        public BuildPropertyTestProjectIndicator(IServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            projectSystem = serviceProvider.GetService <IProjectSystemHelper>();
            projectSystem.AssertLocalServiceIsNotNull();

            propertyManager = serviceProvider.GetMefService <IProjectPropertyManager>();
            Debug.Assert(propertyManager != null, $"Failed to get {nameof(IProjectPropertyManager)}");
        }
        public ProjectSystemFilter(IHost host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.projectSystem = host.GetService<IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.propertyManager = host.GetMefService<IProjectPropertyManager>();
            Debug.Assert(this.propertyManager != null, $"Failed to get {nameof(IProjectPropertyManager)}");
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Returns whether or not a project is of a known test project type.
        /// </summary>
        public static bool IsKnownTestProject(this IProjectSystemHelper projectSystem, IVsHierarchy vsProject)
        {
            if (projectSystem == null)
            {
                throw new ArgumentNullException(nameof(projectSystem));
            }

            if (vsProject == null)
            {
                throw new ArgumentNullException(nameof(vsProject));
            }

            return(projectSystem.GetAggregateProjectKinds(vsProject).Contains(ProjectSystemHelper.TestProjectKindGuid));
        }
Ejemplo n.º 19
0
        internal /*for testing purposes*/ BindingController(IHost host, IBindingWorkflowExecutor workflowExecutor)
            : base(host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.host = host;

            this.BindCommand         = new RelayCommand <BindCommandArgs>(this.OnBind, this.OnBindStatus);
            this.workflowExecutor    = workflowExecutor ?? this;
            this.projectSystemHelper = this.host.GetService <IProjectSystemHelper>();
            this.projectSystemHelper.AssertLocalServiceIsNotNull();
        }
        internal /*for testing purposes*/ BindingController(IHost host, IBindingWorkflowExecutor workflow)
            : base(host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.host = host;

            this.BindCommand = new RelayCommand<ProjectViewModel>(this.OnBind, this.OnBindStatus);
            this.workflow = workflow ?? this;
            this.projectSystemHelper = this.ServiceProvider.GetService<IProjectSystemHelper>();
            this.projectSystemHelper.AssertLocalServiceIsNotNull();
        }
Ejemplo n.º 21
0
        public ConnectionWorkflow(IHost host, ICommand parentCommand)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (parentCommand == null)
            {
                throw new ArgumentNullException(nameof(parentCommand));
            }

            this.host          = host;
            this.parentCommand = parentCommand;
            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();
        }
        public ConnectionWorkflow(IHost host, ICommand parentCommand)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (parentCommand == null)
            {
                throw new ArgumentNullException(nameof(parentCommand));
            }

            this.host = host;
            this.parentCommand = parentCommand;
            this.projectSystem = this.host.GetService<IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();
        }
        public BindingWorkflow(IHost host,
                               BindCommandArgs bindingArgs,
                               ISolutionBindingOperation solutionBindingOperation,
                               INuGetBindingOperation nugetBindingOperation,
                               ISolutionBindingInformationProvider bindingInformationProvider,
                               bool isFirstBinding = false)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            if (bindingArgs == null)
            {
                throw new ArgumentNullException(nameof(bindingArgs));
            }
            Debug.Assert(bindingArgs.ProjectKey != null);
            Debug.Assert(bindingArgs.ProjectName != null);
            Debug.Assert(bindingArgs.Connection != null);

            if (solutionBindingOperation == null)
            {
                throw new ArgumentNullException(nameof(solutionBindingOperation));
            }

            if (nugetBindingOperation == null)
            {
                throw new ArgumentNullException(nameof(nugetBindingOperation));
            }

            if (bindingInformationProvider == null)
            {
                throw new ArgumentNullException(nameof(bindingInformationProvider));
            }

            this.host          = host;
            this.bindingArgs   = bindingArgs;
            this.projectSystem = this.host.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.solutionBindingOperation   = solutionBindingOperation;
            this.NuGetBindingOperation      = nugetBindingOperation;
            this.bindingInformationProvider = bindingInformationProvider;
            this.IsFirstBinding             = isFirstBinding;
        }
Ejemplo n.º 24
0
        internal /* for testing purposes */ DeprecatedSonarRuleSetManager(IActiveSolutionBoundTracker activeSolutionBoundTracker,
                                                                          IActiveSolutionTracker activeSolutionTracker, IProjectSystemHelper projectSystemHelper,
                                                                          ISolutionRuleSetsInformationProvider ruleSetProvider, ILogger logger)
        {
            if (activeSolutionBoundTracker == null)
            {
                throw new ArgumentNullException(nameof(activeSolutionBoundTracker));
            }

            if (activeSolutionTracker == null)
            {
                throw new ArgumentNullException(nameof(activeSolutionTracker));
            }

            if (projectSystemHelper == null)
            {
                throw new ArgumentNullException(nameof(projectSystemHelper));
            }

            if (ruleSetProvider == null)
            {
                throw new ArgumentNullException(nameof(ruleSetProvider));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            this.activeSolutionBoundTracker = activeSolutionBoundTracker;
            this.activeSolutionTracker      = activeSolutionTracker;
            this.projectSystemHelper        = projectSystemHelper;
            this.ruleSetProvider            = ruleSetProvider;
            this.logger = logger;

            this.activeSolutionBoundTracker.SolutionBindingChanged += OnSolutionBindingChanged;
            this.activeSolutionTracker.ActiveSolutionChanged       += OnActiveSolutionChanged;

            if (this.activeSolutionBoundTracker.CurrentConfiguration != null &&
                this.activeSolutionBoundTracker.CurrentConfiguration.Mode != NewConnectedMode.SonarLintMode.LegacyConnected)
            {
                WarnIfAnyProjectHasSonarRuleSet();
            }
        }
        internal /*for testing purposes*/ ConnectionController(IHost host, IConnectionInformationProvider connectionProvider,
                                                               IConnectionWorkflowExecutor workflowExecutor)
            : base(host)
        {
            if (host == null)
            {
                throw new ArgumentNullException(nameof(host));
            }

            this.host               = host;
            this.WorkflowExecutor   = workflowExecutor ?? this;
            this.connectionProvider = connectionProvider ?? this;

            this.projectSystemHelper = this.host.GetService <IProjectSystemHelper>();
            this.projectSystemHelper.AssertLocalServiceIsNotNull();

            this.ConnectCommand = new RelayCommand(this.OnConnect, this.CanConnect);
            this.RefreshCommand = new RelayCommand <ConnectionInformation>(this.OnRefresh, this.CanRefresh);
        }
        internal SolutionBindingOperation(IServiceProvider serviceProvider,
                                          SonarLintMode bindingMode,
                                          IProjectBinderFactory projectBinderFactory,
                                          ILegacyConfigFolderItemAdder legacyConfigFolderItemAdder,
                                          IFileSystem fileSystem)
        {
            bindingMode.ThrowIfNotConnected();

            serviceProvider = serviceProvider ?? throw new ArgumentNullException(nameof(serviceProvider));
            this.legacyConfigFolderItemAdder = legacyConfigFolderItemAdder ?? throw new ArgumentNullException(nameof(legacyConfigFolderItemAdder));
            this.fileSystem           = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            this.projectBinderFactory = projectBinderFactory ?? throw new ArgumentNullException(nameof(projectBinderFactory));

            this.bindingMode = bindingMode;

            this.projectSystem = serviceProvider.GetService <IProjectSystemHelper>();
            this.projectSystem.AssertLocalServiceIsNotNull();

            this.sourceControlledFileSystem = serviceProvider.GetService <ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();
        }