File tree Expand file tree Collapse file tree 6 files changed +36
-6
lines changed
dart-lang/src/main/java/fr/insideapp/sonarqube/dart/lang
main/java/fr/insideapp/sonarqube/flutter
test/java/fr/insideapp/sonarqube/flutter Expand file tree Collapse file tree 6 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ jobs:
1313 fetch-depth : 0
1414
1515 - name : Set up JDK 1.11
16- uses : actions/setup-java@v3.12.0
16+ uses : actions/setup-java@v4
1717 with :
1818 distribution : ' adopt'
19- java-version : ' 11 '
19+ java-version : ' 17 '
2020 check-latest : true
2121 cache : ' maven'
2222
Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ jobs:
1919 id : tag_name
2020
2121 - name : Set up JDK 1.11
22- uses : actions/setup-java@v3.12.0
22+ uses : actions/setup-java@v4
2323 with :
2424 distribution : ' adopt'
25- java-version : ' 11 '
25+ java-version : ' 17 '
2626 check-latest : true
2727 cache : ' maven'
2828
Original file line number Diff line number Diff line change 1717#### Bug Fixes
1818
1919- [ #177 ] ( https://github.com/insideapp-oss/sonar-flutter/issues/177 ) analyzer execution fails when errors detected.
20+ - [ #212 ] ( https://github.com/insideapp-oss/sonar-flutter/issues/212 ) source file not indexed with SonarQube 10.4+
21+ -
2022
2123## 0.5.0
2224
Original file line number Diff line number Diff line change 1717 */
1818package fr .insideapp .sonarqube .dart .lang ;
1919
20+ import org .apache .commons .lang3 .StringUtils ;
2021import org .sonar .api .config .Configuration ;
2122import org .sonar .api .resources .AbstractLanguage ;
2223
24+ import java .util .Arrays ;
25+ import java .util .List ;
26+ import java .util .stream .Collectors ;
27+
2328
2429public class Dart extends AbstractLanguage {
2530 public static final String KEY = "dart" ;
2631 private final Configuration config ;
2732
33+ public static final List <String > FILE_SUFFIXES = List .of (".dart" );
34+
35+ public static final String FILE_SUFFIXES_KEY = "sonar.dart.file.suffixes" ;
36+
2837 public Dart (Configuration config ) {
2938 super (KEY , "Dart" );
3039 this .config = config ;
3140 }
3241
3342 public String [] getFileSuffixes () {
34- return new String []{"dart" };
43+ final List <String > providedFilesSuffixes = Arrays .stream (config .getStringArray (FILE_SUFFIXES_KEY ))
44+ .map (String ::trim )
45+ .filter (StringUtils ::isNotBlank )
46+ .collect (Collectors .toList ());
47+ final List <String > filesSuffixes = providedFilesSuffixes .isEmpty () ? FILE_SUFFIXES : providedFilesSuffixes ;
48+ return filesSuffixes .toArray (new String [0 ]);
3549 }
3650}
Original file line number Diff line number Diff line change @@ -39,16 +39,30 @@ public class FlutterPlugin implements Plugin {
3939 public static final String DART_CATEGORY = "Dart" ;
4040 public static final String FLUTTER_CATEGORY = "Flutter" ;
4141 public static final String ANALYSIS_SUBCATEGORY = "Analysis" ;
42+
43+ public static final String GENERAL_SUBCATEGORY = "General" ;
4244 public static final String TESTS_SUBCATEGORY = "Tests" ;
4345
4446 public static final String FLUTTER_TESTS_REPORT_PATH_KEY = "sonar.flutter.tests.reportPath" ;
4547 public static final String FLUTTER_LCOV_REPORT_PATH_KEY = "sonar.flutter.coverage.reportPath" ;
4648
49+
4750 public void define (Context context ) {
4851
4952 // Language support
5053 context .addExtensions (Dart .class , DartSensor .class , DartProfile .class );
5154
55+ context .addExtension (
56+ PropertyDefinition .builder (Dart .FILE_SUFFIXES_KEY )
57+ .name ("File Suffixes" )
58+ .description ("List of suffixes of Dart files to analyze." )
59+ .multiValues (true )
60+ .category (DART_CATEGORY )
61+ .subCategory (GENERAL_SUBCATEGORY )
62+ .onQualifiers (Qualifiers .PROJECT )
63+ .defaultValue (String .join ("," , Dart .FILE_SUFFIXES ))
64+ .build ());
65+
5266 // Add pubspec support
5367 context .addExtension (PubSpecSensor .class );
5468
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public void define() {
4242 plugin .define (context );
4343
4444 List <?> extensions = context .getExtensions ();
45- assertThat (extensions ).hasSize (14 );
45+ assertThat (extensions ).hasSize (15 );
4646
4747
4848 }
You can’t perform that action at this time.
0 commit comments