File tree Expand file tree Collapse file tree
sonar-plugin/sonar-javascript-plugin/src
main/java/org/sonar/plugins/javascript/analysis
test/java/org/sonar/plugins/javascript/analysis Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121import java .io .File ;
2222import java .io .IOException ;
23+ import java .util .ArrayList ;
2324import java .util .Arrays ;
2425import java .util .List ;
2526import java .util .function .Predicate ;
3536import org .sonar .plugins .javascript .bridge .BridgeServer ;
3637import org .sonar .plugins .javascript .bridge .BridgeServerConfig ;
3738import org .sonar .plugins .javascript .bridge .ServerAlreadyFailedException ;
38- import org .sonar .plugins .javascript .external .EslintReportImporter ;
3939import org .sonar .plugins .javascript .external .ExternalIssueRepository ;
40+ import org .sonar .plugins .javascript .external .Issue ;
4041import org .sonar .plugins .javascript .nodejs .NodeCommandException ;
4142import org .sonar .plugins .javascript .utils .Exclusions ;
4243
@@ -67,8 +68,7 @@ public void execute(SensorContext context) {
6768 environments = Arrays .asList (context .config ().getStringArray (JavaScriptPlugin .ENVIRONMENTS ));
6869 globals = Arrays .asList (context .config ().getStringArray (JavaScriptPlugin .GLOBALS ));
6970
70- var eslintReportImporter = new EslintReportImporter ();
71- var esLintIssues = eslintReportImporter .execute (context );
71+ var esLintIssues = this .getESLintIssues (context );
7272
7373 try {
7474 List <InputFile > inputFiles = getInputFiles ();
@@ -142,4 +142,8 @@ protected abstract List<BridgeServer.Issue> analyzeFiles(List<InputFile> inputFi
142142 throws IOException ;
143143
144144 protected abstract List <InputFile > getInputFiles ();
145+
146+ protected List <Issue > getESLintIssues (SensorContext context ) {
147+ return new ArrayList <>();
148+ }
145149}
Original file line number Diff line number Diff line change 2323import org .sonar .api .batch .fs .FilePredicate ;
2424import org .sonar .api .batch .fs .FileSystem ;
2525import org .sonar .api .batch .fs .InputFile ;
26+ import org .sonar .api .batch .sensor .SensorContext ;
2627import org .sonar .api .batch .sensor .SensorDescriptor ;
2728import org .sonar .plugins .javascript .JavaScriptFilePredicate ;
2829import org .sonar .plugins .javascript .JavaScriptLanguage ;
2930import org .sonar .plugins .javascript .TypeScriptLanguage ;
3031import org .sonar .plugins .javascript .bridge .AnalysisMode ;
3132import org .sonar .plugins .javascript .bridge .BridgeServer ;
33+ import org .sonar .plugins .javascript .external .EslintReportImporter ;
34+ import org .sonar .plugins .javascript .external .Issue ;
3235
3336@ DependedUpon ("js-analysis" )
3437public class JsTsSensor extends AbstractBridgeSensor {
@@ -84,4 +87,11 @@ protected List<BridgeServer.Issue> analyzeFiles(List<InputFile> inputFiles) thro
8487
8588 return issues ;
8689 }
90+
91+ @ Override
92+ protected List <Issue > getESLintIssues (SensorContext context ) {
93+ var importer = new EslintReportImporter ();
94+
95+ return importer .execute (context );
96+ }
8797}
Original file line number Diff line number Diff line change @@ -193,6 +193,12 @@ void should_have_descriptor() throws Exception {
193193 assertThat (descriptor .languages ()).containsOnly ("js" , "ts" );
194194 }
195195
196+ /**
197+ * todo
198+ *
199+ * this test should belong to the test suite of the component that actually does the deduplication - namely `AbstractBridgeSensor`;
200+ * but there is no test suite for this component.
201+ */
196202 @ Test
197203 void should_de_duplicate_issues () throws Exception {
198204 JsTsSensor sensor = createSensor ();
You can’t perform that action at this time.
0 commit comments