build: update Dart, dart analyzer to 3.2.4 (#5065)

Recent versions of dart analyzer don't support the --options
configuration option anymore, so we cannot pass an arbitrary
configuration file. This commit removes the default dart analyzer
configuration file as well, because it's not needed anymore.
This commit is contained in:
Marco Ferrari 2023-12-26 22:14:57 +01:00 committed by GitHub
parent 1dc74e194e
commit 4d9eaa5c54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 97 deletions

View file

@ -28,6 +28,7 @@ FROM scalameta/scalafmt:v3.7.17 as scalafmt
FROM zricethezav/gitleaks:v8.18.1 as gitleaks FROM zricethezav/gitleaks:v8.18.1 as gitleaks
FROM yoheimuta/protolint:0.47.3 as protolint FROM yoheimuta/protolint:0.47.3 as protolint
FROM ghcr.io/clj-kondo/clj-kondo:2023.05.18-alpine as clj-kondo FROM ghcr.io/clj-kondo/clj-kondo:2023.05.18-alpine as clj-kondo
FROM dart:3.2.4-sdk as dart
FROM python:3.12.1-alpine3.19 as base_image FROM python:3.12.1-alpine3.19 as base_image
@ -221,6 +222,13 @@ RUN --mount=type=secret,id=GITHUB_TOKEN /install-glibc.sh && rm -rf /install-gli
##################### #####################
COPY --from=clj-kondo /bin/clj-kondo /usr/bin/ COPY --from=clj-kondo /bin/clj-kondo /usr/bin/
####################
# Install dart-sdk #
####################
ENV DART_SDK /usr/lib/dart
COPY --from=dart "${DART_SDK}" "${DART_SDK}"
RUN chmod 755 "${DART_SDK}" && chmod 755 "${DART_SDK}/bin"
################# #################
# Install Lintr # # Install Lintr #
################# #################
@ -259,13 +267,6 @@ RUN --mount=type=secret,id=GITHUB_TOKEN /install-ktlint.sh && rm -rf /install-kt
################################################# #################################################
RUN apk add --no-cache rakudo zef RUN apk add --no-cache rakudo zef
####################
# Install dart-sdk #
####################
ARG DART_VERSION='2.8.4'
COPY scripts/install-dart-sdk.sh /
RUN /install-dart-sdk.sh && rm -rf /install-dart-sdk.sh
###################### ######################
# Install CheckStyle # # Install CheckStyle #
###################### ######################
@ -320,6 +321,7 @@ ENV PATH="${PATH}:/venvs/yamllint/bin"
ENV PATH="${PATH}:/venvs/yq/bin" ENV PATH="${PATH}:/venvs/yq/bin"
ENV PATH="${PATH}:/node_modules/.bin" ENV PATH="${PATH}:/node_modules/.bin"
ENV PATH="${PATH}:/usr/lib/go/bin" ENV PATH="${PATH}:/usr/lib/go/bin"
ENV PATH="${PATH}:${DART_SDK}/bin:/root/.pub-cache/bin"
# Configure TFLint plugin folder # Configure TFLint plugin folder
ENV TFLINT_PLUGIN_DIR="/root/.tflint.d/plugins" ENV TFLINT_PLUGIN_DIR="/root/.tflint.d/plugins"

View file

@ -1,57 +0,0 @@
---
##########################
##########################
## Dart Linter rules ##
##########################
##########################
# Pedantic Rules
# https://github.com/dart-lang/pedantic
linter:
rules:
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_empty_else
- avoid_init_to_null
- avoid_null_checks_in_equality_operators
- avoid_relative_lib_imports
- avoid_return_types_on_setters
- avoid_shadowing_type_parameters
- avoid_types_as_parameter_names
- camel_case_extensions
- curly_braces_in_flow_control_structures
- empty_catches
- empty_constructor_bodies
- library_names
- library_prefixes
- no_duplicate_case_values
- null_closures
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_is_empty
- prefer_is_not_empty
- prefer_iterable_whereType
- prefer_single_quotes
- prefer_spread_collections
- recursive_getters
- slash_for_doc_comments
- type_init_formals
- unawaited_futures
- unnecessary_const
- unnecessary_new
- unnecessary_null_in_if_null_operators
- unnecessary_this
- unrelated_type_equality_checks
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps

View file

@ -8,6 +8,15 @@ This document helps you upgrade from a super-linter version to newer ones:
This section helps you migrate from super-linter `v5` to `v6`. This section helps you migrate from super-linter `v5` to `v6`.
### Dart
- super-linter doesn't include a default configuration file for `dart analyzer`
because the Dart SDK doesn't support running `dart analyzer` against an
arbitrary configuration file anymore. For more information about how to
customize static analysis of Dart files, see
[Customizing static analysis](https://dart.dev/tools/analysis) in the Dart SDK
documentation.
### Experimental batch workers ### Experimental batch workers
- Experimental batch support is deprecated. You can safely remove the - Experimental batch support is deprecated. You can safely remove the

View file

@ -140,8 +140,6 @@ CLOUDFORMATION_FILE_NAME=".cfnlintrc.yml"
# shellcheck disable=SC2034 # Variable is referenced indirectly # shellcheck disable=SC2034 # Variable is referenced indirectly
COFFEESCRIPT_FILE_NAME=".coffee-lint.json" COFFEESCRIPT_FILE_NAME=".coffee-lint.json"
CSS_FILE_NAME="${CSS_FILE_NAME:-.stylelintrc.json}" CSS_FILE_NAME="${CSS_FILE_NAME:-.stylelintrc.json}"
# shellcheck disable=SC2034 # Variable is referenced indirectly
DART_FILE_NAME="analysis_options.yml"
DOCKERFILE_HADOLINT_FILE_NAME="${DOCKERFILE_HADOLINT_FILE_NAME:-.hadolint.yaml}" DOCKERFILE_HADOLINT_FILE_NAME="${DOCKERFILE_HADOLINT_FILE_NAME:-.hadolint.yaml}"
EDITORCONFIG_FILE_NAME="${EDITORCONFIG_FILE_NAME:-.ecrc}" EDITORCONFIG_FILE_NAME="${EDITORCONFIG_FILE_NAME:-.ecrc}"
# shellcheck disable=SC2034 # Variable is referenced indirectly # shellcheck disable=SC2034 # Variable is referenced indirectly
@ -947,7 +945,7 @@ LINTER_COMMANDS_ARRAY['COFFEESCRIPT']="coffeelint -f ${COFFEESCRIPT_LINTER_RULES
LINTER_COMMANDS_ARRAY['CPP']="cpplint" LINTER_COMMANDS_ARRAY['CPP']="cpplint"
LINTER_COMMANDS_ARRAY['CSHARP']="dotnet format whitespace --folder --verify-no-changes --exclude / --include" LINTER_COMMANDS_ARRAY['CSHARP']="dotnet format whitespace --folder --verify-no-changes --exclude / --include"
LINTER_COMMANDS_ARRAY['CSS']="stylelint --config ${CSS_LINTER_RULES}" LINTER_COMMANDS_ARRAY['CSS']="stylelint --config ${CSS_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['DART']="dartanalyzer --fatal-infos --fatal-warnings --options ${DART_LINTER_RULES}" LINTER_COMMANDS_ARRAY['DART']="dart analyze --fatal-infos --fatal-warnings"
LINTER_COMMANDS_ARRAY['DOCKERFILE_HADOLINT']="hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}" LINTER_COMMANDS_ARRAY['DOCKERFILE_HADOLINT']="hadolint -c ${DOCKERFILE_HADOLINT_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['EDITORCONFIG']="editorconfig-checker -config ${EDITORCONFIG_LINTER_RULES}" LINTER_COMMANDS_ARRAY['EDITORCONFIG']="editorconfig-checker -config ${EDITORCONFIG_LINTER_RULES}"
LINTER_COMMANDS_ARRAY['ENV']="dotenv-linter" LINTER_COMMANDS_ARRAY['ENV']="dotenv-linter"

View file

@ -1,24 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
case $TARGETARCH in
amd64)
target=x64
;;
arm64)
target=arm64
;;
*)
echo "$TARGETARCH is not supported"
exit 1
;;
esac
curl --retry 5 --retry-delay 5 -sO "https://storage.googleapis.com/dart-archive/channels/stable/release/${DART_VERSION}/sdk/dartsdk-linux-${target}-release.zip"
unzip -q dartsdk-linux-${target}-release.zip
chmod +x dart-sdk/bin/dart*
mv -v dart-sdk/bin/* /usr/bin/
mv -v dart-sdk/lib/* /usr/lib/
mv -v dart-sdk/include/* /usr/include/
rm -rv dart-sdk/ dartsdk-linux-${target}-release.zip

View file

@ -483,7 +483,6 @@ control "super-linter-validate-files" do
"/action/lib/.automation/.stylelintrc.json", "/action/lib/.automation/.stylelintrc.json",
"/action/lib/.automation/.tflint.hcl", "/action/lib/.automation/.tflint.hcl",
"/action/lib/.automation/.yaml-lint.yml", "/action/lib/.automation/.yaml-lint.yml",
"/action/lib/.automation/analysis_options.yml",
"/action/lib/.automation/phpcs.xml", "/action/lib/.automation/phpcs.xml",
"/action/lib/.automation/phpstan.neon", "/action/lib/.automation/phpstan.neon",
"/action/lib/.automation/psalm.xml", "/action/lib/.automation/psalm.xml",

View file

@ -1,5 +1,3 @@
// empty_constructor_bodies bad {} void increment() {
class Point { count++;
int x, y;
Point(this.x, this.y) {}
} }

View file

@ -1,4 +1,3 @@
// empty_constructor_bodies good ;
class Point { class Point {
int x, y; int x, y;
Point(this.x, this.y); Point(this.x, this.y);