From 95f0c2d534fa3b34f4389ec9e687ad7842d2df9f Mon Sep 17 00:00:00 2001 From: Casey Vega Date: Tue, 14 Jul 2020 23:36:22 -0700 Subject: [PATCH] add dart pub get and --fatal flags - add `pub get || true` - add --fatal flags to throw 1 on exit Adding `pub get` enables dart to import dev/project dependencies before analysis/linting. It is set to always return true in the event this has already occured somewhere else in the CI workflow a pubspec.yaml does not exist Using `--fatal-(infos|warnings)` allows super-linter to fail when a lint is reported. --- lib/linter.sh | 2 +- lib/worker.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/linter.sh b/lib/linter.sh index 778c2aef..4950ff7d 100755 --- a/lib/linter.sh +++ b/lib/linter.sh @@ -1185,7 +1185,7 @@ if [ "$VALIDATE_DART" == "true" ]; then # Lint the Dart files # ####################### # LintCodebase "FILE_TYPE" "LINTER_NAME" "LINTER_CMD" "FILE_TYPES_REGEX" "FILE_ARRAY" - LintCodebase "DART" "dart" "dartanalyzer --options $DART_LINTER_RULES" ".*\.\(dart\)\$" "${FILE_ARRAY_DART[@]}" + LintCodebase "DART" "dart" "pub get || true && dartanalyzer --fatal-infos --fatal-warnings --options $DART_LINTER_RULES" ".*\.\(dart\)\$" "${FILE_ARRAY_DART[@]}" fi ################## diff --git a/lib/worker.sh b/lib/worker.sh index a8589ea8..3400871a 100755 --- a/lib/worker.sh +++ b/lib/worker.sh @@ -479,7 +479,7 @@ function RunTestCases() { TestCodebase "KOTLIN" "ktlint" "ktlint" ".*\.\(kt\|kts\)\$" "kotlin" TestCodebase "PROTOBUF" "protolint" "protolint lint --config_path $PROTOBUF_LINTER_RULES" ".*\.\(proto\)\$" "protobuf" TestCodebase "OPENAPI" "spectral" "spectral lint -r $OPENAPI_LINTER_RULES" ".*\.\(ymlopenapi\|jsonopenapi\)\$" "openapi" - TestCodebase "DART" "dart" "dartanalyzer --fatal-infos --options $DART_LINTER_RULES" ".*\.\(dart\)\$" "dart" + TestCodebase "DART" "dart" "dartanalyzer --fatal-infos --fatal-warnings --options $DART_LINTER_RULES" ".*\.\(dart\)\$" "dart" TestCodebase "HTML" "htmlhint" "htmlhint --config $HTML_LINTER_RULES" ".*\.\(html\)\$" "html" #################