chore: remove clippy script, run clippy directly (#5953)

Remove clippy.sh script and run cargo-clippy directly. The script was
needed because when we introduced cargo-clippy, Super-linter didn't have
a way to customize the working directory when running linters and
formatters. Now, we can use GNU Parallel to handle that case.

This will unblock the work to do to implement #4001 (pass custom options
to cargo-clippy).
This commit is contained in:
Marco Ferrari 2024-08-02 13:24:43 +02:00 committed by GitHub
parent 928972feeb
commit c46346c774
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 5 additions and 16 deletions

1
.gitignore vendored
View file

@ -95,3 +95,4 @@ test/linters/rust_clippy/**/target/**
super-linter-output/ super-linter-output/
custom-super-linter-output-directory-name/ custom-super-linter-output-directory-name/
super-linter-github-actions-step-summary-output* super-linter-github-actions-step-summary-output*
github-step-summary.md

View file

@ -467,9 +467,6 @@ RUN apk add --no-cache \
rust-clippy \ rust-clippy \
rustfmt rustfmt
COPY scripts/clippy.sh /usr/bin/clippy
RUN chmod +x /usr/bin/clippy
################################### ###################################
# Install DotNet and Dependencies # # Install DotNet and Dependencies #
################################### ###################################

View file

@ -113,7 +113,8 @@ LINTER_COMMANDS_ARRAY_RUBY=(rubocop -c "${RUBY_LINTER_RULES}" --force-exclusion
LINTER_COMMANDS_ARRAY_RUST_2015=(rustfmt --check --edition 2015) LINTER_COMMANDS_ARRAY_RUST_2015=(rustfmt --check --edition 2015)
LINTER_COMMANDS_ARRAY_RUST_2018=(rustfmt --check --edition 2018) LINTER_COMMANDS_ARRAY_RUST_2018=(rustfmt --check --edition 2018)
LINTER_COMMANDS_ARRAY_RUST_2021=(rustfmt --check --edition 2021) LINTER_COMMANDS_ARRAY_RUST_2021=(rustfmt --check --edition 2021)
LINTER_COMMANDS_ARRAY_RUST_CLIPPY=(clippy) # Consume the input as we do with ANSIBLE
LINTER_COMMANDS_ARRAY_RUST_CLIPPY=(cargo-clippy "&& echo \"Linted: {}\"")
LINTER_COMMANDS_ARRAY_SCALAFMT=(scalafmt --config "${SCALAFMT_LINTER_RULES}" --test) LINTER_COMMANDS_ARRAY_SCALAFMT=(scalafmt --config "${SCALAFMT_LINTER_RULES}" --test)
LINTER_COMMANDS_ARRAY_SHELL_SHFMT=(shfmt -d) LINTER_COMMANDS_ARRAY_SHELL_SHFMT=(shfmt -d)
LINTER_COMMANDS_ARRAY_SNAKEMAKE_LINT=(snakemake --lint -s) LINTER_COMMANDS_ARRAY_SNAKEMAKE_LINT=(snakemake --lint -s)

View file

@ -128,6 +128,7 @@ function LintCodebase() {
if [[ ${FILE_TYPE} == "CSHARP" ]] || if [[ ${FILE_TYPE} == "CSHARP" ]] ||
[[ (${FILE_TYPE} == "R" && -f "$(dirname "${FILE}")/.lintr") ]] || [[ (${FILE_TYPE} == "R" && -f "$(dirname "${FILE}")/.lintr") ]] ||
[[ ${FILE_TYPE} == "KOTLIN" ]] || [[ ${FILE_TYPE} == "KOTLIN" ]] ||
[[ ${FILE_TYPE} == "RUST_CLIPPY" ]] ||
[[ ${FILE_TYPE} == "TERRAFORM_TFLINT" ]]; then [[ ${FILE_TYPE} == "TERRAFORM_TFLINT" ]]; then
LINTER_WORKING_DIRECTORY="{//}" LINTER_WORKING_DIRECTORY="{//}"
elif [[ ${FILE_TYPE} == "ANSIBLE" ]] || elif [[ ${FILE_TYPE} == "ANSIBLE" ]] ||

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
pushd "$(dirname "$1")" || exit 1
cargo-clippy
rc=$?
popd || exit 1
exit $rc

View file

@ -143,7 +143,7 @@ control "super-linter-installed-commands" do
{ linter_name: "checkstyle", version_command: "java -jar /usr/bin/checkstyle --version"}, { linter_name: "checkstyle", version_command: "java -jar /usr/bin/checkstyle --version"},
{ linter_name: "chktex"}, { linter_name: "chktex"},
{ linter_name: "clang-format"}, { linter_name: "clang-format"},
{ linter_name: "clippy", linter_command: "clippy", version_command: "cargo-clippy --version"}, { linter_name: "clippy", linter_command: "cargo-clippy"},
{ linter_name: "clj-kondo"}, { linter_name: "clj-kondo"},
{ linter_name: "coffeelint"}, { linter_name: "coffeelint"},
{ linter_name: "composer"}, { linter_name: "composer"},