diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index d66067ff2c745255c86924f71e0e1009ca7ef51b..82c06241b59c7aea989642c5b8a9836148b97479 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -26,11 +26,7 @@ jobs: - name: Register matcher run: echo ::add-matcher::./.github/python_matcher.json - name: Test code with pylint - uses: ./github_actions/pylint - with: - config-file: .pylintrc - files: '**/*.py' - exclude-path: third_party + runs: ./tools/run_pylint.sh yapf: runs-on: ubuntu-18.04 diff --git a/github_actions/pylint/Dockerfile b/github_actions/pylint/Dockerfile deleted file mode 100644 index 63fbb9af8da7f0a8c913cf0271793d0ddf1997d4..0000000000000000000000000000000000000000 --- a/github_actions/pylint/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.7-alpine - -RUN apk add --no-cache bash build-base gcc -RUN pip install --upgrade pip -RUN pip install pylint -RUN python --version ; pip --version ; pylint --version - -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh -ENTRYPOINT ["/entrypoint.sh"] diff --git a/github_actions/pylint/action.yml b/github_actions/pylint/action.yml deleted file mode 100644 index 7ca6dda1609003b12cdda86d8f64afa710ab5f2e..0000000000000000000000000000000000000000 --- a/github_actions/pylint/action.yml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: 'Pylint' -description: 'Runs pylint across multiple files/modules' -author: 'Jean-Michel Picod <jmichel@google.com>' -inputs: - config-file: - description: pylintrc configuration file - required: false - files: - description: files, directories, or globs - required: true - ignore-files: - description: files to ignore/exclude - required: false - exclude-path: - description: paths to ignore/exclude - required: false -runs: - using: docker - image: Dockerfile diff --git a/github_actions/pylint/entrypoint.sh b/github_actions/pylint/entrypoint.sh deleted file mode 100644 index da48ac585b269b2b2287149173ea71c650b3e2ea..0000000000000000000000000000000000000000 --- a/github_actions/pylint/entrypoint.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash - -env - -PYLINT_CMD="pylint --score=n${INPUT_CONFIG_FILE:+ --rcfile=${INPUT_CONFIG_FILE}}" -EXCLUDE_PATH=${INPUT_EXCLUDE_PATH:-} -EXCLUDE_FILES=${INPUT_EXCLUDE_PATH:-} - -SUCCESS=0 -for file in ${FILES} -do - fname=$(basename $file) - directory=$(dirname $file) - if [[ "$directory" =~ "^${EXCLUDE_PATH}" ]] - then - echo "Ignoring file '$file' (reason: matching exclude-path parameter)" - continue - fi - if [[ "$fname" =~ "${EXCLUDE_FILES}" ]] - then - echo "Ignoring file '$file' (reason: matching exclude-files parameter)" - continue - fi - # Just to trigger the custom matcher - echo PYLINT:$file - if ! $PYLINT_CMD $file - then - SUCCESS=1 - fi -done - -exit $SUCCESS diff --git a/tools/run_pylint.sh b/tools/run_pylint.sh new file mode 100755 index 0000000000000000000000000000000000000000..cdb79194ae88a5ae7bc7241b55b099f5561ffa3e --- /dev/null +++ b/tools/run_pylint.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +SUCCESS=0 + +# Ensure we are at the project root directory +cd $(readlink -f $(dirname $0))/.. + +for file in `find . ! -path "./third_party/*" -type f -name '*.py'` +do + # Output header for our custom matcher on Github workflow + echo "PYLINT:${file}" + if ! pylint --rcfile=.pylintrc --score=n "$file" + then + SUCCESS=1 + fi +done + +exit $SUCCESS