use of org.sonarsource.sonarlint.core.analysis.api.AnalysisConfiguration in project sonarlint-core by SonarSource.
the class AnalysisEngineMediumTests method should_analyze_a_file_inside_a_module.
@Test
void should_analyze_a_file_inside_a_module(@TempDir Path baseDir) throws Exception {
var content = "def foo():\n" + " x = 9; # trailing comment\n";
ClientInputFile inputFile = preparePythonInputFile(baseDir, content);
AnalysisConfiguration analysisConfig = AnalysisConfiguration.builder().addInputFiles(inputFile).addActiveRules(trailingCommentRule()).setBaseDir(baseDir).build();
List<Issue> issues = new ArrayList<>();
analysisEngine.post(new RegisterModuleCommand(new ClientModuleInfo("moduleKey", aModuleFileSystem())), progressMonitor).get();
analysisEngine.post(new AnalyzeCommand("moduleKey", analysisConfig, issues::add, null), progressMonitor).get();
assertThat(issues).extracting("ruleKey", "message", "inputFile", "flows", "quickFixes", "textRange.startLine", "textRange.startLineOffset", "textRange.endLine", "textRange.endLineOffset").containsOnly(tuple("python:S139", "Move this trailing comment on the previous empty line.", inputFile, List.of(), List.of(), 2, 9, 2, 27));
}
Aggregations