From 9a0c800872318844c5b6afdc48c07636d79a6100 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 28 Jun 2024 16:13:58 +0200 Subject: [PATCH 1/8] 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) --- planemo_ci_actions.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/planemo_ci_actions.sh b/planemo_ci_actions.sh index 3c7734d..046d5f8 100755 --- a/planemo_ci_actions.sh +++ b/planemo_ci_actions.sh @@ -110,10 +110,12 @@ 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"/.tt_skip + (planemo shed_lint --tools --ensure_metadata --urls --skip_file "$DIR"/.tt_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 From 685abc867a427bc303f790e080cf0ef2cc44e757 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 28 Jun 2024 18:14:46 +0200 Subject: [PATCH 2/8] temp install planemo from path --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 73f5c26..0b51633 100644 --- a/action.yml +++ b/action.yml @@ -112,7 +112,7 @@ runs: # Install the `wheel` package so that when installing other packages which # are not available as wheels, pip will build a wheel for them, which can be cached. - name: Install planemo - run: pip install wheel ${{ inputs.planemo-version }} + run: pip install git+https://github.com/bernt-matthias/planemo@linters-list shell: bash - name: Install jq run: sudo apt-get install jq From a90535f8d356b1ec247e3e69fd2ff42e6e8b485f Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 4 Jul 2024 19:50:02 +0200 Subject: [PATCH 3/8] add test for skipping a linter --- .github/workflows/tools.yaml | 5 +++++ test/tools/tool1/.lint_skip | 1 + 2 files changed, 6 insertions(+) create mode 100644 test/tools/tool1/.lint_skip diff --git a/.github/workflows/tools.yaml b/.github/workflows/tools.yaml index 505ad9e..45e20b8 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 ToolIDValid) != "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/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 From 343d1dd7335b32029a2a29ba8b0760dff895691d Mon Sep 17 00:00:00 2001 From: M Bernt Date: Fri, 5 Jul 2024 09:56:34 +0200 Subject: [PATCH 4/8] Revert installing planemo from branch --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 0b51633..73f5c26 100644 --- a/action.yml +++ b/action.yml @@ -112,7 +112,7 @@ runs: # Install the `wheel` package so that when installing other packages which # are not available as wheels, pip will build a wheel for them, which can be cached. - name: Install planemo - run: pip install git+https://github.com/bernt-matthias/planemo@linters-list + run: pip install wheel ${{ inputs.planemo-version }} shell: bash - name: Install jq run: sudo apt-get install jq From 36c6cb847895ffeac2b996b15ed2bbef47bb4e13 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 5 Jul 2024 10:01:00 +0200 Subject: [PATCH 5/8] add docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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 ---------- From 5f371e22f4d3203eb338fca0775183751f8c13fb Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 5 Jul 2024 10:15:32 +0200 Subject: [PATCH 6/8] fix test --- .github/workflows/tools.yaml | 2 +- planemo_ci_actions.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tools.yaml b/.github/workflows/tools.yaml index 45e20b8..b581e4d 100644 --- a/.github/workflows/tools.yaml +++ b/.github/workflows/tools.yaml @@ -184,7 +184,7 @@ jobs: run: | set -x # check if the ToolIDValid linter is called (no of tools - 1 ) times, i.e. is skipped once - if [ "$(grep -c ToolIDValid ToolIDValid) != "2" ]; then + if [ "$(grep -c ToolIDValid lint_report.txt)" != "2" ]; then echo "expecting exactly 2 tests for ToolIDValid"; exit 1; fi grep tool1 lint_report.txt diff --git a/planemo_ci_actions.sh b/planemo_ci_actions.sh index 046d5f8..2b832b3 100755 --- a/planemo_ci_actions.sh +++ b/planemo_ci_actions.sh @@ -115,6 +115,7 @@ if [ "$MODE" == "lint" ]; then for DIR in "${REPO_ARRAY[@]}"; do if [ "$WORKFLOWS" != "true" ]; then cat .lint_skip >> "$DIR"/.tt_skip + cat "$DIR"/.tt_skip (planemo shed_lint --tools --ensure_metadata --urls --skip_file "$DIR"/.tt_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 From dc49a76a34329749caa6463ed7a1c0842f8eeeb7 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Fri, 5 Jul 2024 12:01:57 +0200 Subject: [PATCH 7/8] fix file names --- planemo_ci_actions.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/planemo_ci_actions.sh b/planemo_ci_actions.sh index 2b832b3..4d2256a 100755 --- a/planemo_ci_actions.sh +++ b/planemo_ci_actions.sh @@ -114,9 +114,9 @@ if [ "$MODE" == "lint" ]; then mapfile -t REPO_ARRAY < repository_list.txt for DIR in "${REPO_ARRAY[@]}"; do if [ "$WORKFLOWS" != "true" ]; then - cat .lint_skip >> "$DIR"/.tt_skip - cat "$DIR"/.tt_skip - (planemo shed_lint --tools --ensure_metadata --urls --skip_file "$DIR"/.tt_skip --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 From 33af59a0268b4b6686c5421da7d407985ffa4b73 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Thu, 4 Jul 2024 19:20:29 +0200 Subject: [PATCH 8/8] fix test --- .github/workflows/tools.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tools.yaml b/.github/workflows/tools.yaml index b581e4d..7a65209 100644 --- a/.github/workflows/tools.yaml +++ b/.github/workflows/tools.yaml @@ -190,7 +190,7 @@ jobs: grep tool1 lint_report.txt grep tool2 lint_report.txt grep "ERROR: Error 'HTTPConnectionPool" lint_report.txt - grep "Applying linter tests... CHECK" lint_report.txt + grep "TestsNoValid" lint_report.txt test-tools: name: Test testing of tools needs: [setup-ci-tools]