diff --git a/src/ConnectedMode.UnitTests/Binding/BindingProcessFactoryTests.cs b/src/ConnectedMode.UnitTests/Binding/BindingProcessFactoryTests.cs index 80bcdf2bc..c10eb1c1e 100644 --- a/src/ConnectedMode.UnitTests/Binding/BindingProcessFactoryTests.cs +++ b/src/ConnectedMode.UnitTests/Binding/BindingProcessFactoryTests.cs @@ -37,7 +37,6 @@ public class BindingProcessFactoryTests public void MefCtor_CheckIsExported() { MefTestHelpers.CheckTypeCanBeImported( - MefTestHelpers.CreateExport(), MefTestHelpers.CreateExport(), MefTestHelpers.CreateExport()); } @@ -55,15 +54,13 @@ public void Create_ReturnsProcessImpl() } private static BindingProcessFactory CreateTestSubject( - ISonarQubeService service = null, IQualityProfileDownloader qualityProfileDownloader = null, ILogger logger = null) { - service ??= Mock.Of(); qualityProfileDownloader ??= Mock.Of(); logger ??= new TestLogger(logToConsole: true); - return new BindingProcessFactory(service, qualityProfileDownloader, logger); + return new BindingProcessFactory(qualityProfileDownloader, logger); } } diff --git a/src/ConnectedMode.UnitTests/Binding/BindingProcessImplTests.cs b/src/ConnectedMode.UnitTests/Binding/BindingProcessImplTests.cs index c579792fd..3c763d157 100644 --- a/src/ConnectedMode.UnitTests/Binding/BindingProcessImplTests.cs +++ b/src/ConnectedMode.UnitTests/Binding/BindingProcessImplTests.cs @@ -29,7 +29,6 @@ using SonarLint.VisualStudio.Core.Binding; using SonarLint.VisualStudio.TestInfrastructure; using SonarQube.Client; -using SonarQube.Client.Models; using SonarQube.Client.Helpers; using System.Security; @@ -45,36 +44,22 @@ public void Ctor_ArgChecks() { var bindingArgs = CreateBindCommandArgs(); var qpDownloader = Mock.Of(); - var sonarQubeService = Mock.Of(); + Mock.Of(); var logger = Mock.Of(); // 1. Null binding args - Action act = () => new BindingProcessImpl(null, sonarQubeService, qpDownloader, logger); + Action act = () => new BindingProcessImpl(null, qpDownloader, logger); act.Should().ThrowExactly().And.ParamName.Should().Be("bindingArgs"); - // 3. Null SonarQube service - act = () => new BindingProcessImpl(bindingArgs, null, qpDownloader, logger); - act.Should().ThrowExactly().And.ParamName.Should().Be("sonarQubeService"); - - // 4. Null QP downloader - act = () => new BindingProcessImpl(bindingArgs, sonarQubeService, null, logger); + // 2. Null QP downloader + act = () => new BindingProcessImpl(bindingArgs, null, logger); act.Should().ThrowExactly().And.ParamName.Should().Be("qualityProfileDownloader"); - // 5. Null logger - act = () => new BindingProcessImpl(bindingArgs, sonarQubeService, qpDownloader, null); + // 3. Null logger + act = () => new BindingProcessImpl(bindingArgs, qpDownloader, null); act.Should().ThrowExactly().And.ParamName.Should().Be("logger"); } - private static ServerExclusions CreateSettings() - { - return new ServerExclusions - { - Inclusions = new string[] { "inclusion1", "inclusion2" }, - Exclusions = new string[] { "exclusion" }, - GlobalExclusions = new string[] { "globalExclusion" } - }; - } - [TestMethod] public async Task DownloadQualityProfile_CreatesBoundProjectAndCallsQPDownloader() { @@ -132,17 +117,14 @@ public async Task DownloadQualityProfile_HandlesInvalidOperationException() #region Helpers private BindingProcessImpl CreateTestSubject(BindCommandArgs bindingArgs = null, - ISonarQubeService sonarQubeService = null, IQualityProfileDownloader qpDownloader = null, ILogger logger = null) { bindingArgs = bindingArgs ?? CreateBindCommandArgs(); - sonarQubeService ??= Mock.Of(); qpDownloader ??= Mock.Of(); logger ??= new TestLogger(logToConsole: true); return new BindingProcessImpl(bindingArgs, - sonarQubeService, qpDownloader, logger); } diff --git a/src/ConnectedMode/Binding/BindingProcessImpl.cs b/src/ConnectedMode/Binding/BindingProcessImpl.cs index 08e6d4c2e..e7caa4676 100644 --- a/src/ConnectedMode/Binding/BindingProcessImpl.cs +++ b/src/ConnectedMode/Binding/BindingProcessImpl.cs @@ -18,37 +18,23 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading; -using System.Threading.Tasks; -using SonarLint.VisualStudio.ConnectedMode.Persistence; using SonarLint.VisualStudio.ConnectedMode.QualityProfiles; using SonarLint.VisualStudio.Core; -using SonarLint.VisualStudio.Core.Analysis; -using SonarLint.VisualStudio.Core.Binding; -using SonarQube.Client; -using SonarQube.Client.Models; -using Language = SonarLint.VisualStudio.Core.Language; namespace SonarLint.VisualStudio.ConnectedMode.Binding { internal class BindingProcessImpl : IBindingProcess { private readonly BindCommandArgs bindingArgs; - private readonly ISonarQubeService sonarQubeService; private readonly IQualityProfileDownloader qualityProfileDownloader; private readonly ILogger logger; public BindingProcessImpl( BindCommandArgs bindingArgs, - ISonarQubeService sonarQubeService, IQualityProfileDownloader qualityProfileDownloader, ILogger logger) { this.bindingArgs = bindingArgs ?? throw new ArgumentNullException(nameof(bindingArgs)); - this.sonarQubeService = sonarQubeService ?? throw new ArgumentNullException(nameof(sonarQubeService)); this.qualityProfileDownloader = qualityProfileDownloader ?? throw new ArgumentNullException(nameof(qualityProfileDownloader)); this.logger = logger ?? throw new ArgumentNullException(nameof(logger)); } diff --git a/src/ConnectedMode/Binding/IBindingProcessFactory.cs b/src/ConnectedMode/Binding/IBindingProcessFactory.cs index c68bb69b8..382611e72 100644 --- a/src/ConnectedMode/Binding/IBindingProcessFactory.cs +++ b/src/ConnectedMode/Binding/IBindingProcessFactory.cs @@ -21,8 +21,6 @@ using System.ComponentModel.Composition; using SonarLint.VisualStudio.ConnectedMode.QualityProfiles; using SonarLint.VisualStudio.Core; -using SonarLint.VisualStudio.Core.Analysis; -using SonarQube.Client; namespace SonarLint.VisualStudio.ConnectedMode.Binding { @@ -38,17 +36,14 @@ internal interface IBindingProcessFactory [PartCreationPolicy(CreationPolicy.Shared)] internal class BindingProcessFactory : IBindingProcessFactory { - private readonly ISonarQubeService sonarQubeService; private readonly IQualityProfileDownloader qualityProfileDownloader; private readonly ILogger logger; [ImportingConstructor] public BindingProcessFactory( - ISonarQubeService sonarQubeService, IQualityProfileDownloader qualityProfileDownloader, ILogger logger) { - this.sonarQubeService = sonarQubeService; this.qualityProfileDownloader = qualityProfileDownloader; this.logger = logger; } @@ -56,7 +51,6 @@ public BindingProcessFactory( public IBindingProcess Create(BindCommandArgs bindingArgs) { return new BindingProcessImpl(bindingArgs, - sonarQubeService, qualityProfileDownloader, logger); } diff --git a/src/Integration.Vsix/SonarLintTagger/TaggerProvider.cs b/src/Integration.Vsix/SonarLintTagger/TaggerProvider.cs index 1254a5fa0..9b135252b 100644 --- a/src/Integration.Vsix/SonarLintTagger/TaggerProvider.cs +++ b/src/Integration.Vsix/SonarLintTagger/TaggerProvider.cs @@ -162,8 +162,6 @@ public ITagger CreateTagger(ITextBuffer buffer) where T : ITag var tagger = singletonTaggerManager.CreateTagger(buffer); return tagger as ITagger; - - return null; } private TextBufferIssueTracker InternalCreateTextBufferIssueTracker(ITextDocument textDocument, IEnumerable analysisLanguages) =>