diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorImporterTestBase.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorImporterTestBase.java index b034a193df8..dcc0e5a0d52 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorImporterTestBase.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorImporterTestBase.java @@ -37,30 +37,26 @@ import static org.mockito.Mockito.mock; public class RazorImporterTestBase { - protected final static File TEST_DATA_DIR = new File("src/test/resources/RazorProtobufImporter"); - protected final SensorContextTester sensorContext = SensorContextTester.create(TEST_DATA_DIR); + protected final static String TEST_DATA_DIR = "src/test/resources/RazorProtobufImporter"; + protected final static String WEB_PROJECT_PATH = Paths.get(TEST_DATA_DIR, "WebProject").toString(); + protected final static String ROSLYN_4_9_DIR = Paths.get(TEST_DATA_DIR, "Roslyn 4.9").toString(); + protected final static String ROSLYN_4_10_DIR = Paths.get(TEST_DATA_DIR, "Roslyn 4.10").toString(); + protected final SensorContextTester sensorContext = SensorContextTester.create(new File(TEST_DATA_DIR)); + @Rule public LogTester logTester = new LogTester(); - protected DefaultInputFile CasesInputFile; - protected DefaultInputFile OverlapSymbolReferencesInputFile; - protected DefaultInputFile ProgramInputFile; - protected DefaultInputFile PageRazorFile; protected static String fileName(String filePath) { return Paths.get(filePath).getFileName().toString(); } @Before - public void setUp() throws FileNotFoundException { + public void setUp() { logTester.setLevel(Level.TRACE); - CasesInputFile = addTestFileToContext("Cases.razor"); - PageRazorFile = addTestFileToContext("Page.razor"); - OverlapSymbolReferencesInputFile = addTestFileToContext("OverlapSymbolReferences.razor"); - ProgramInputFile = addTestFileToContext("Program.cs"); } - private DefaultInputFile addTestFileToContext(String testFilePath) throws FileNotFoundException { - var testFile = new File(TEST_DATA_DIR, testFilePath); + protected DefaultInputFile addTestFileToContext(String testFilePath) throws FileNotFoundException { + var testFile = new File(WEB_PROJECT_PATH, testFilePath); assertThat(testFile).withFailMessage("no such file: " + testFilePath).isFile(); var inputFile = new TestInputFileBuilder("dummyKey", testFilePath) .setMetadata(new FileMetadata(mock(AnalysisWarnings.class)).readMetadata(new FileReader(testFile))) diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorMetricsImporterTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorMetricsImporterTest.java index 9889d038c81..45b035e8717 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorMetricsImporterTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorMetricsImporterTest.java @@ -21,7 +21,11 @@ import java.io.File; import java.io.FileNotFoundException; +import java.util.Arrays; import java.util.Collections; +import java.util.function.Function; +import java.util.stream.Collectors; + import org.assertj.core.groups.Tuple; import org.junit.Before; import org.junit.Test; @@ -41,24 +45,57 @@ import static org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.METRICS_FILENAME; public class RazorMetricsImporterTest extends RazorImporterTestBase { - private static final File PROTOBUF_FILE = new File(TEST_DATA_DIR, METRICS_FILENAME); + private static final File PROTOBUF_4_9_FILE = new File(ROSLYN_4_9_DIR, METRICS_FILENAME); + private static final File PROTOBUF_4_10_FILE = new File(ROSLYN_4_10_DIR, METRICS_FILENAME); @Before @Override - public void setUp() throws FileNotFoundException { + public void setUp() { super.setUp(); - assertThat(PROTOBUF_FILE).withFailMessage("no such file: " + PROTOBUF_FILE).isFile(); + assertThat(PROTOBUF_4_9_FILE).withFailMessage("no such file: " + PROTOBUF_4_9_FILE).isFile(); + assertThat(PROTOBUF_4_10_FILE).withFailMessage("no such file: " + PROTOBUF_4_10_FILE).isFile(); + } + + @Test + public void roslyn_metrics_are_imported_before_4_10() throws FileNotFoundException { + var inputFile = addTestFileToContext("Cases.razor"); + var noSonarFilter = mock(NoSonarFilter.class); + var fileLinesContext = mock(FileLinesContext.class); + var fileLinesContextFactory = mock(FileLinesContextFactory.class); + when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext); + + new MetricsImporter(sensorContext, fileLinesContextFactory, noSonarFilter, RazorImporterTestBase::fileName).accept(PROTOBUF_4_9_FILE.toPath()); + + var measures = sensorContext.measures(inputFile.key()); + assertThat(measures).hasSize(7); + + assertThat(measures).extracting("metric", "value") + .containsOnly( + Tuple.tuple(CoreMetrics.COMPLEXITY, 5), + Tuple.tuple(CoreMetrics.FUNCTIONS, 3), + Tuple.tuple(CoreMetrics.COMMENT_LINES, 0), + Tuple.tuple(CoreMetrics.COGNITIVE_COMPLEXITY, 1), + Tuple.tuple(CoreMetrics.CLASSES, 0), + Tuple.tuple(CoreMetrics.NCLOC, 13), + Tuple.tuple(CoreMetrics.STATEMENTS, 6)); + + verify(noSonarFilter).noSonarInFile(inputFile, Collections.emptySet()); + + verifyMetrics(fileLinesContext, CoreMetrics.EXECUTABLE_LINES_DATA_KEY, 8, 23, 24); + verifyMetrics(fileLinesContext, CoreMetrics.NCLOC_DATA_KEY, 3, 5, 8, 9, 13, 16, 18, 19, 21, 22, 23, 24, 25); + + assertThat(logTester.logs(Level.DEBUG)).isEmpty(); } @Test - public void roslyn_metrics_are_imported() { - var inputFile = CasesInputFile; + public void roslyn_metrics_are_imported_starting_with_4_10() throws FileNotFoundException { + var inputFile = addTestFileToContext("Cases.razor"); var noSonarFilter = mock(NoSonarFilter.class); var fileLinesContext = mock(FileLinesContext.class); var fileLinesContextFactory = mock(FileLinesContextFactory.class); when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(fileLinesContext); - new MetricsImporter(sensorContext, fileLinesContextFactory, noSonarFilter, RazorImporterTestBase::fileName).accept(PROTOBUF_FILE.toPath()); + new MetricsImporter(sensorContext, fileLinesContextFactory, noSonarFilter, RazorImporterTestBase::fileName).accept(PROTOBUF_4_10_FILE.toPath()); var measures = sensorContext.measures(inputFile.key()); assertThat(measures).hasSize(7); @@ -75,27 +112,30 @@ public void roslyn_metrics_are_imported() { verify(noSonarFilter).noSonarInFile(inputFile, Collections.emptySet()); - verify(fileLinesContext).setIntValue(CoreMetrics.EXECUTABLE_LINES_DATA_KEY, 8, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.EXECUTABLE_LINES_DATA_KEY, 23, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.EXECUTABLE_LINES_DATA_KEY, 24, 1); - - verify(fileLinesContext, times(4)).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 1, 1); - verify(fileLinesContext, times(2)).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 3, 1); - verify(fileLinesContext, times(2)).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 5, 1); - verify(fileLinesContext, times(2)).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 5, 1); - - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 8, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 9, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 13, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 16, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 18, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 19, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 21, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 22, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 23, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 24, 1); - verify(fileLinesContext).setIntValue(CoreMetrics.NCLOC_DATA_KEY, 25, 1); - - assertThat(logTester.logs(Level.DEBUG)).containsExactly("The code line number was out of the range. File Page.razor, Line 4"); + verifyMetrics(fileLinesContext, CoreMetrics.EXECUTABLE_LINES_DATA_KEY, 8, 23, 24); + verifyMetrics(fileLinesContext, CoreMetrics.NCLOC_DATA_KEY, 1, 3, 5, 8, 9, 13, 16, 18, 19, 21, 22, 23, 24, 25); + + assertThat(logTester.logs(Level.DEBUG)).isEmpty(); + } + + @Test + public void roslyn_metrics_out_of_range_with_4_10() throws FileNotFoundException { + addTestFileToContext("_Imports.razor"); + var fileLinesContextFactory = mock(FileLinesContextFactory.class); + when(fileLinesContextFactory.createFor(any(InputFile.class))).thenReturn(mock(FileLinesContext.class)); + + new MetricsImporter(sensorContext, fileLinesContextFactory, mock(NoSonarFilter.class), RazorImporterTestBase::fileName).accept(PROTOBUF_4_10_FILE.toPath()); + + assertThat(logTester.logs(Level.DEBUG)).containsExactly("The code line number was out of the range. File _Imports.razor, Line 4"); + } + + private void verifyMetrics(FileLinesContext context, String key, int... values) { + var groups = Arrays.stream(values) + .boxed() + .collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); + + for (int groupKey : groups.keySet()){ + verify(context, times(groups.get(groupKey).intValue())).setIntValue(key, groupKey, 1); + } } } diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorSymbolRefsImporterTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorSymbolRefsImporterTest.java index 9b53836aedd..576a84f3e86 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorSymbolRefsImporterTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/protobuf/RazorSymbolRefsImporterTest.java @@ -30,19 +30,57 @@ import static org.sonarsource.dotnet.shared.plugins.ProtobufDataImporter.SYMBOLREFS_FILENAME; public class RazorSymbolRefsImporterTest extends RazorImporterTestBase { - private final File protobuf = new File(TEST_DATA_DIR, SYMBOLREFS_FILENAME); + private static final File PROTOBUF_4_9_FILE = new File(ROSLYN_4_9_DIR, SYMBOLREFS_FILENAME); + private static final File PROTOBUF_4_10_FILE = new File(ROSLYN_4_10_DIR, SYMBOLREFS_FILENAME); @Override @Before - public void setUp() throws FileNotFoundException { + public void setUp() { super.setUp(); - assertThat(protobuf).withFailMessage("no such file: " + protobuf).isFile(); + assertThat(PROTOBUF_4_9_FILE).withFailMessage("no such file: " + PROTOBUF_4_9_FILE).isFile(); } @Test - public void test_symbol_refs_get_imported_cases() { + public void test_symbol_refs_get_imported_cases_before_4_10() throws FileNotFoundException { - var inputFile = CasesInputFile; + verifySymbolRef(PROTOBUF_4_9_FILE); + } + + @Test + public void test_symbol_refs_get_imported_cases_after_4_10() throws FileNotFoundException { + verifySymbolRef(PROTOBUF_4_10_FILE); + } + + @Test + public void test_symbol_refs_get_imported_overlapSymbolReferences_before_4_10() throws FileNotFoundException { + var inputFile = addTestFileToContext("OverlapSymbolReferences.razor"); + var sut = new SymbolRefsImporter(sensorContext, s -> Paths.get(s).getFileName().toString()); + sut.accept(PROTOBUF_4_9_FILE.toPath()); + sut.save(); + + var references = sensorContext.referencesForSymbolAt(inputFile.key(), 1, 1); + assertThat(references) + .isNotNull() // The symbol declaration can be found, + .isEmpty(); // but there are no references, due to the overlap. + + assertThat(logTester.logs(Level.DEBUG)).containsExactly( + "The declaration token at Range[from [line=1, lineOffset=0] to [line=1, lineOffset=17]] overlaps with the referencing token Range[from [line=1, lineOffset=6] to [line=1, lineOffset=23]] in file OverlapSymbolReferences.razor"); + } + + @Test + public void test_symbol_refs_get_imported_overlapSymbolReferences_after_4_10() throws FileNotFoundException { + var inputFile = addTestFileToContext("OverlapSymbolReferences.razor"); + var sut = new SymbolRefsImporter(sensorContext, s -> Paths.get(s).getFileName().toString()); + sut.accept(PROTOBUF_4_10_FILE.toPath()); + sut.save(); + + // the issue with overlapping symbols has been fixed in dotnet 8.0.5 + assertThat(sensorContext.referencesForSymbolAt(inputFile.key(), 1, 11)).hasSize(1); + assertThat(logTester.logs(Level.DEBUG)).isEmpty(); + } + + private void verifySymbolRef(File protobuf) throws FileNotFoundException { + var inputFile = addTestFileToContext("Cases.razor");; var sut = new SymbolRefsImporter(sensorContext, RazorImporterTestBase::fileName); sut.accept(protobuf.toPath()); sut.save(); @@ -57,16 +95,4 @@ public void test_symbol_refs_get_imported_cases() { assertThat(logTester.logs(Level.DEBUG)).isEmpty(); } - - @Test - public void test_symbol_refs_get_imported_overlapSymbolReferences() { - var inputFile = OverlapSymbolReferencesInputFile; - var sut = new SymbolRefsImporter(sensorContext, s -> Paths.get(s).getFileName().toString()); - sut.accept(protobuf.toPath()); - sut.save(); - - // the issue with overlapping symbols has been fixed in dotnet 8.0.5 - assertThat(sensorContext.referencesForSymbolAt(inputFile.key(), 1, 11)).hasSize(1); - assertThat(logTester.logs(Level.DEBUG)).isEmpty(); - } } diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/file-metadata.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/file-metadata.pb new file mode 100644 index 00000000000..b6c26beed96 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/file-metadata.pb @@ -0,0 +1,4 @@ + +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.csutf-8 +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.csutf-8| +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.csutf-8 \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/global.json b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/global.json new file mode 100644 index 00000000000..7fa817ce306 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.300" + } +} \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/log.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/log.pb new file mode 100644 index 00000000000..8b513351b3b --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/log.pb @@ -0,0 +1 @@ +Roslyn version: 4.10.0.0Language version: CSharp12!Concurrent execution: enabledFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\_Imports_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\OverlapSymbolReferences_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Cases_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.cs' was recognized as generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.cs' was recognized as generated \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/metrics.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/metrics.pb new file mode 100644 index 00000000000..70474993227 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/metrics.pb @@ -0,0 +1,5 @@ + +wC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\_Imports.razor8r +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\OverlapSymbolReferences.razor8r +tC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Cases.razor 8r x +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs 8r \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/symrefs.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/symrefs.pb new file mode 100644 index 00000000000..aa8cd541aa9 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/symrefs.pb @@ -0,0 +1,15 @@ +y +wC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\_Imports.razor +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\OverlapSymbolReferences.razor + # 4 +tC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Cases.razor +  ( )2 +    & ( +     '  + +  +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs + +  + +  \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-cpd.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-cpd.pb similarity index 67% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-cpd.pb rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-cpd.pb index 5bca6669368..3a306aff816 100644 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-cpd.pb +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-cpd.pb @@ -1,5 +1,5 @@ - -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Program.cs + +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs namespace  WebAss  diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-type.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-type.pb new file mode 100644 index 00000000000..226d139051b --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.10/token-type.pb @@ -0,0 +1,5 @@ + +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs +  +       +     \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/file-metadata.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/file-metadata.pb new file mode 100644 index 00000000000..b6c26beed96 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/file-metadata.pb @@ -0,0 +1,4 @@ + +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.csutf-8 +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.csutf-8| +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.csutf-8 \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/global.json b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/global.json new file mode 100644 index 00000000000..e99a8a81d8b --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/global.json @@ -0,0 +1,5 @@ +{ + "sdk": { + "version": "8.0.202" + } +} \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/log.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/log.pb new file mode 100644 index 00000000000..1b76b5ec1b6 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/log.pb @@ -0,0 +1 @@ +Roslyn version: 4.9.0.0Language version: CSharp12!Concurrent execution: enabledFile 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\_Imports_razor.g.cs' was recognized as razor generatedFile 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\OverlapSymbolReferences_razor.g.cs' was recognized as razor generatedFile 'Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Cases_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.cs' was recognized as generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.cs' was recognized as generated \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/metrics.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/metrics.pb new file mode 100644 index 00000000000..ab6cb562de1 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/metrics.pb @@ -0,0 +1,5 @@ + +wC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\_Imports.razor8r +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\OverlapSymbolReferences.razor8r +tC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Cases.razor 8r  x  +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs 8r \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/symrefs.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/symrefs.pb new file mode 100644 index 00000000000..acf76cdc8df --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/symrefs.pb @@ -0,0 +1,15 @@ +y +wC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\_Imports.razor +C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\OverlapSymbolReferences.razor +   +tC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Cases.razor +  ( )2 +    & ( +     '  + +  +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs + +  + +  \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-cpd.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-cpd.pb new file mode 100644 index 00000000000..3a306aff816 --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-cpd.pb @@ -0,0 +1,20 @@ + +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs + namespace  +WebAss +  +;  +public  +class  +Program  +{  +public + +static  +void  +Main  +(  +)  +{  +} ! +}  \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-type.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-type.pb new file mode 100644 index 00000000000..226d139051b --- /dev/null +++ b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Roslyn 4.9/token-type.pb @@ -0,0 +1,5 @@ + +sC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\WebProject\Program.cs +  +       +     \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/BlazorWebAssembly.csproj b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/BlazorWebAssembly.csproj similarity index 100% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/BlazorWebAssembly.csproj rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/BlazorWebAssembly.csproj diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Cases.razor b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/Cases.razor similarity index 100% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Cases.razor rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/Cases.razor diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/OverlapSymbolReferences.razor b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/OverlapSymbolReferences.razor similarity index 100% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/OverlapSymbolReferences.razor rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/OverlapSymbolReferences.razor diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Program.cs b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/Program.cs similarity index 100% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Program.cs rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/Program.cs diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Page.razor b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/_Imports.razor similarity index 100% rename from sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/Page.razor rename to sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/WebProject/_Imports.razor diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/file-metadata.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/file-metadata.pb deleted file mode 100644 index 00ac303019b..00000000000 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/file-metadata.pb +++ /dev/null @@ -1,4 +0,0 @@ - -C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.csutf-8 -C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.csutf-8q -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Program.csutf-8 \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/log.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/log.pb deleted file mode 100644 index 10d2e75b78c..00000000000 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/log.pb +++ /dev/null @@ -1 +0,0 @@ -Roslyn version: 4.10.0.0Language version: CSharp12!Concurrent execution: enabledFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Page_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\OverlapSymbolReferences_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\Microsoft.CodeAnalysis.Razor.Compiler\Microsoft.NET.Sdk.Razor.SourceGenerators.RazorSourceGenerator\Cases_razor.g.cs' was recognized as razor generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\BlazorWebAssembly.AssemblyInfo.cs' was recognized as generatedFile 'C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\obj\Debug\net8.0\.NETCoreApp,Version=v8.0.AssemblyAttributes.cs' was recognized as generated \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/metrics.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/metrics.pb deleted file mode 100644 index 70b5df0f0cb..00000000000 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/metrics.pb +++ /dev/null @@ -1,5 +0,0 @@ -q -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Page.razor8r -{C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\OverlapSymbolReferences.razor8r -iC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Cases.razor 8r xw -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Program.cs 8r \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/symrefs.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/symrefs.pb deleted file mode 100644 index 11ace77c947..00000000000 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/symrefs.pb +++ /dev/null @@ -1,15 +0,0 @@ -j -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Page.razor -{C:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\OverlapSymbolReferences.razor - # 4 -iC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Cases.razor -  ( )2 -    & ( -     '  - -  -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Program.cs - -  - -  \ No newline at end of file diff --git a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-type.pb b/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-type.pb deleted file mode 100644 index 40907bb2a66..00000000000 --- a/sonar-dotnet-shared-library/src/test/resources/RazorProtobufImporter/token-type.pb +++ /dev/null @@ -1,5 +0,0 @@ - -hC:\src\work\sonar-dotnet\sonar-dotnet-shared-library\src\test\resources\RazorProtobufImporter\Program.cs -  -       -     \ No newline at end of file