Skip to content

Commit e9aa19c

Browse files
committed
Quality flaw fixes
1 parent c674f52 commit e9aa19c

File tree

7 files changed

+67
-37
lines changed

7 files changed

+67
-37
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="Program.cs" company="SonarSource SA and Microsoft Corporation">
3+
// Copyright (c) SonarSource SA and Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License. See License.txt in the project root for license information.
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using SonarQube.Common;
9+
using SonarQube.TeamBuild.PostProcessor;
10+
using SonarQube.TeamBuild.PostProcessor.Interfaces;
11+
using SonarQube.TeamBuild.PreProcessor;
12+
using SonarScanner.Shim;
13+
14+
namespace SonarQube.Bootstrapper
15+
{
16+
public class DefaultProcessorFactory : IProcessorFactory
17+
{
18+
private readonly ILogger logger;
19+
20+
public DefaultProcessorFactory(ILogger logger)
21+
{
22+
this.logger = logger;
23+
}
24+
public IMSBuildPostProcessor CreatePostProcessor()
25+
{
26+
return new MSBuildPostProcessor(
27+
new CoverageReportProcessor(),
28+
new SonarScannerWrapper(),
29+
new SummaryReportBuilder(),
30+
logger,
31+
new TargetsUninstaller());
32+
}
33+
34+
public ITeamBuildPreProcessor CreatePreProcessor()
35+
{
36+
IPreprocessorObjectFactory factory = new PreprocessorObjectFactory();
37+
return new TeamBuildPreProcessor(factory, logger);
38+
}
39+
}
40+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="IBootstrapperSettings.cs" company="SonarSource SA and Microsoft Corporation">
3+
// Copyright (c) SonarSource SA and Microsoft Corporation. All rights reserved.
4+
// Licensed under the MIT License. See License.txt in the project root for license information.
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using SonarQube.TeamBuild.PostProcessor.Interfaces;
9+
using SonarQube.TeamBuild.PreProcessor;
10+
11+
namespace SonarQube.Bootstrapper
12+
{
13+
public interface IProcessorFactory
14+
{
15+
IMSBuildPostProcessor CreatePostProcessor();
16+
ITeamBuildPreProcessor CreatePreProcessor();
17+
}
18+
}

SonarQube.Bootstrapper/Program.cs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,5 @@ public static int Main(string[] args)
3434
BootstrapperClass bootstrapper = new BootstrapperClass(processorFactory, settings, logger);
3535
return bootstrapper.Execute();
3636
}
37-
38-
public interface IProcessorFactory
39-
{
40-
IMSBuildPostProcessor CreatePostProcessor();
41-
ITeamBuildPreProcessor CreatePreProcessor();
42-
}
43-
44-
public class DefaultProcessorFactory : IProcessorFactory
45-
{
46-
private readonly ILogger logger;
47-
48-
public DefaultProcessorFactory(ILogger logger)
49-
{
50-
this.logger = logger;
51-
}
52-
public IMSBuildPostProcessor CreatePostProcessor()
53-
{
54-
return new MSBuildPostProcessor(
55-
new CoverageReportProcessor(),
56-
new SonarScannerWrapper(),
57-
new SummaryReportBuilder(),
58-
logger,
59-
new TargetsUninstaller());
60-
}
61-
62-
public ITeamBuildPreProcessor CreatePreProcessor()
63-
{
64-
IPreprocessorObjectFactory factory = new PreprocessorObjectFactory();
65-
return new TeamBuildPreProcessor(factory, logger);
66-
}
67-
}
6837
}
6938
}

SonarQube.Bootstrapper/SonarQube.Bootstrapper.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
<Compile Include="ArgumentProcessor.cs" />
5151
<Compile Include="BootstrapperClass.cs" />
5252
<Compile Include="BootstrapperSettings.cs" />
53+
<Compile Include="Interfaces\IProcessorFactory.cs" />
5354
<Compile Include="Interfaces\IBootstrapperSettings.cs" />
55+
<Compile Include="DefaultProcessorFactory.cs" />
5456
<Compile Include="Program.cs" />
5557
<Compile Include="Properties\AssemblyInfo.cs" />
5658
<Compile Include="Resources.Designer.cs">

SonarQube.Common/Utilities.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static bool Retry(int timeoutInMilliseconds, int pauseBetweenTriesInMilli
4141
{
4242
throw new ArgumentNullException("op");
4343
}
44-
44+
4545
logger.LogDebug(Resources.MSG_BeginningRetry, timeoutInMilliseconds, pauseBetweenTriesInMilliseconds);
4646

4747
Stopwatch timer = Stopwatch.StartNew();
@@ -148,11 +148,11 @@ public static bool TryEnsureEmptyDirectories(ILogger logger, params string[] dir
148148

149149
public static bool IsSecuredServerProperty(string s)
150150
{
151-
return s.EndsWith(".secured", StringComparison.InvariantCultureIgnoreCase);
151+
return s.EndsWith(".secured", StringComparison.OrdinalIgnoreCase);
152152
}
153153

154154
/// <summary>
155-
/// Common logic for handling web exceptions when connecting to the SonarQube server. Common exceptions
155+
/// Common logic for handling web exceptions when connecting to the SonarQube server. Common exceptions
156156
/// are handled by logging user friendly errors.
157157
/// </summary>
158158
/// <returns>True if the exception was handled</returns>

SonarQube.TeamBuild.PostProcessor/MSBuildPostProcessor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ namespace SonarQube.TeamBuild.PostProcessor
1717
{
1818
public class MSBuildPostProcessor : IMSBuildPostProcessor
1919
{
20+
private const string scanAllFiles = "-Dsonar.scanAllFiles=true";
21+
2022
private readonly ICoverageReportProcessor codeCoverageProcessor;
2123
private readonly ISummaryReportBuilder reportBuilder;
2224
private readonly ISonarScanner sonarScanner;
2325
private readonly ILogger logger;
24-
private readonly static string scanAllFiles = "-Dsonar.scanAllFiles=true";
2526
private readonly ITargetsUninstaller targetUninstaller;
2627

2728
public MSBuildPostProcessor(ICoverageReportProcessor codeCoverageProcessor, ISonarScanner scanner, ISummaryReportBuilder reportBuilder, ILogger logger,

SonarQube.TeamBuild.PreProcessor/Roslyn/RoslynAnalyzerProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ public class RoslynAnalyzerProvider : IAnalyzerProvider
2121
public const string RoslynFormatNamePrefix = "roslyn-{0}";
2222
public const string RoslynRulesetFileName = "SonarQubeRoslyn-{0}.ruleset";
2323

24-
private static readonly string SONARANALYZER_PARTIAL_REPO_KEY = "sonaranalyzer-{0}";
25-
private static readonly string ROSLYN_REPOSITORY_PREFIX = "roslyn.";
24+
private const string SONARANALYZER_PARTIAL_REPO_KEY = "sonaranalyzer-{0}";
25+
private const string ROSLYN_REPOSITORY_PREFIX = "roslyn.";
2626

2727
public const string CSharpLanguage = "cs";
2828
public const string CSharpPluginKey = "csharp";

0 commit comments

Comments
 (0)