Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCAN4NET-43 Multi-language support: Re-enable sonar.sources and sonar.tests #2178

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Tests/SonarScanner.MSBuild.PreProcessor.Test/ProcessedArgsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,6 @@ public void ProcArgs_ParameterThrow_ScannerEnvProperties()
action.Should().Throw<ArgumentNullException>().WithParameterName("scannerEnvProperties");
}

[DataTestMethod]
[DataRow("sonar.sources")]
[DataRow("sonar.tests")]
public void ProcArgs_InvalidPropertiesSet(string propertyName)
{
var provider = Substitute.For<IAnalysisPropertyProvider>();
provider.HasProperty(propertyName).Returns(true);

args = CreateDefaultArgs(provider);

args.IsValid.Should().BeFalse();
logger.AssertSingleErrorExists("The arguments 'sonar.sources' and 'sonar.tests' are not supported. Please remove them and invoke the scanner again.");
}

[TestMethod]
public void ProcArgs_Organization()
{
Expand Down
6 changes: 0 additions & 6 deletions src/SonarScanner.MSBuild.PreProcessor/ProcessedArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ public ProcessedArgs(
? architecture.Value
: RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant();

if (AggregateProperties.HasProperty(SonarProperties.SonarSources)
|| AggregateProperties.HasProperty(SonarProperties.SonarTests))
{
IsValid = false;
logger.LogError(Resources.ERROR_SonarSourcesAndTestsNotSupported);
}
if (AggregateProperties.TryGetProperty(SonarProperties.JavaExePath, out var javaExePath))
{
if (!fileWrapper.Exists(javaExePath.Value))
Expand Down
3 changes: 0 additions & 3 deletions src/SonarScanner.MSBuild.PreProcessor/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,4 @@ If you already have a compatible java version installed, please add either the p
<data name="MSG_JreResolver_NotSupportedByServer" xml:space="preserve">
<value>JreResolver: Skipping Java runtime environment provisioning because this version of SonarQube does not support it.</value>
</data>
<data name="ERROR_SonarSourcesAndTestsNotSupported" xml:space="preserve">
<value>The arguments 'sonar.sources' and 'sonar.tests' are not supported. Please remove them and invoke the scanner again.</value>
</data>
</root>
6 changes: 5 additions & 1 deletion src/SonarScanner.MSBuild.Shim/AdditionalFilesService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ private static bool IsExcludedDirectory(DirectoryInfo directory) =>
part => part.Equals(x, StringComparison.OrdinalIgnoreCase)));

private static string FirstUserSpecifiedSonarParameter(AnalysisConfig analysisConfig) =>
SonarProperties.ScanAllWarningParameters.FirstOrDefault(x => analysisConfig.LocalSettings.Exists(setting => setting.Id == x));
FirstUserSpecifiedSonarParameter(analysisConfig.LocalSettings)
?? FirstUserSpecifiedSonarParameter(analysisConfig.ServerSettings);

private static string FirstUserSpecifiedSonarParameter(AnalysisProperties properties) =>
SonarProperties.ScanAllWarningParameters.FirstOrDefault(x => properties.Exists(setting => setting.Id == x));

private static AdditionalFiles PartitionAdditionalFiles(FileInfo[] allFiles, AnalysisConfig analysisConfig)
{
Expand Down