From 077cb0195e7edc99ad366a14b74472d9493c931d Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 5 Jul 2024 17:09:08 +0200 Subject: [PATCH] Add handling of `.skip_lint` file(s) (#58) * Add handling of a .skip_lint file that allows to list linters to be skipped. a skip file in the repo root and in the tool dir are allowed (and joined) --- .github/workflows/tools.yaml | 5 +++++ README.md | 2 ++ planemo_ci_actions.sh | 5 ++++- test/tools/tool1/.lint_skip | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/tools/tool1/.lint_skip diff --git a/.github/workflows/tools.yaml b/.github/workflows/tools.yaml index 32fd645..7a65209 100644 --- a/.github/workflows/tools.yaml +++ b/.github/workflows/tools.yaml @@ -182,6 +182,11 @@ jobs: continue-on-error: true - name: check if all test tools were linted run: | + set -x + # check if the ToolIDValid linter is called (no of tools - 1 ) times, i.e. is skipped once + if [ "$(grep -c ToolIDValid lint_report.txt)" != "2" ]; then + echo "expecting exactly 2 tests for ToolIDValid"; exit 1; + fi grep tool1 lint_report.txt grep tool2 lint_report.txt grep "ERROR: Error 'HTTPConnectionPool" lint_report.txt diff --git a/README.md b/README.md index 97b4bfa..e3cdb37 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,8 @@ Tools/workflows in a path that has a prefix in: Tools and workflows are discovered in all directories, except for `packages/` and `deprecated/`. These directories may be absent. +A global `.lint_skip` file and per repo `.lint_skip` files can be used to list tool/workflow linters that should be skipped. + Setup mode ---------- diff --git a/planemo_ci_actions.sh b/planemo_ci_actions.sh index 437fdbd..8247442 100755 --- a/planemo_ci_actions.sh +++ b/planemo_ci_actions.sh @@ -110,10 +110,13 @@ fi # - check if each tool is in a repo (i.e. if `.shed.yml` is present) if [ "$MODE" == "lint" ]; then lint_fail=false + touch .lint_skip mapfile -t REPO_ARRAY < repository_list.txt for DIR in "${REPO_ARRAY[@]}"; do if [ "$WORKFLOWS" != "true" ]; then - (planemo shed_lint --tools --ensure_metadata --urls --report_level "$REPORT_LEVEL" --fail_level "$FAIL_LEVEL" --recursive "$DIR" "${ADDITIONAL_PLANEMO_OPTIONS[@]}" | tee -a lint_report.txt) || lint_fail=true + cat .lint_skip >> "$DIR"/.lint_skip + cat "$DIR"/.lint_skip + (planemo shed_lint --tools --ensure_metadata --urls --skip_file "$DIR"/.lint_skip --report_level "$REPORT_LEVEL" --fail_level "$FAIL_LEVEL" --recursive "$DIR" "${ADDITIONAL_PLANEMO_OPTIONS[@]}" | tee -a lint_report.txt) || lint_fail=true else (planemo workflow_lint --report_level "$REPORT_LEVEL" --fail_level "$FAIL_LEVEL" "$DIR" "${ADDITIONAL_PLANEMO_OPTIONS[@]}" | tee -a lint_report.txt) || lint_fail=true fi diff --git a/test/tools/tool1/.lint_skip b/test/tools/tool1/.lint_skip new file mode 100644 index 0000000..780125a --- /dev/null +++ b/test/tools/tool1/.lint_skip @@ -0,0 +1 @@ +ToolIDValid \ No newline at end of file