From 119463f78c05ccc618943c340ac6f2dcfb742498 Mon Sep 17 00:00:00 2001 From: Vito Di Benedetto <55766483+vitodb@users.noreply.github.com> Date: Tue, 26 Dec 2023 15:41:25 -0600 Subject: [PATCH] Re-enable flak8 linter --- .Jenkins/workflows/Jenkinsfile_EL9 | 2 +- .flake8 | 21 +++++++++++++++++++++ .github/workflows/linters.yaml | 5 ++--- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 .flake8 diff --git a/.Jenkins/workflows/Jenkinsfile_EL9 b/.Jenkins/workflows/Jenkinsfile_EL9 index 6a19c65b4..c2e6e3e71 100644 --- a/.Jenkins/workflows/Jenkinsfile_EL9 +++ b/.Jenkins/workflows/Jenkinsfile_EL9 @@ -50,7 +50,7 @@ pipeline { echo "prepare docker image ${flake8StageDockerImage}" sh "docker build --pull --tag ${flake8StageDockerImage} --build-arg BASEIMAGE=hepcloud/decision-engine-ci-el9:${BRANCH} --build-arg UID=\$(id -u) --build-arg GID=\$(id -g) -f decisionengine/package/ci/EL9/Dockerfile decisionengine/package/ci/EL9/" echo "Run ${STAGE_NAME} tests" - sh "docker run --rm --env PYTEST_TIMEOUT=${PYTEST_TIMEOUT} -v ${WORKSPACE}/decisionengine:${WORKSPACE}/decisionengine -w ${WORKSPACE}/decisionengine ${flake8StageDockerImage} \"-m pytest -m flake8 --flake8\" \"flake8.log\"" + sh "docker run --rm --env PYTEST_TIMEOUT=${PYTEST_TIMEOUT} -v ${WORKSPACE}/decisionengine:${WORKSPACE}/decisionengine -w ${WORKSPACE}/decisionengine ${flake8StageDockerImage} \"-m flake8\" \"flake8.log\"" } post { always { diff --git a/.flake8 b/.flake8 new file mode 100644 index 000000000..07e80d5e7 --- /dev/null +++ b/.flake8 @@ -0,0 +1,21 @@ +[flake8] + max-line-length = 120 + # Errors and warnings to ignore + extend-ignore = + # line too long (90 > 79 characters) + E501, + # too many blank lines (2) + E303, + # expected 2 blank lines, found 1 + E302, + # at least two spaces before inline comment + E261, + # block comment should start with '# ' + E265, + # whitespace before ':' + E203, + # permit line breaks in binary operators + W503, + # permit line breaks in binary operators + W504, + diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index db646ff2a..23ee1e8b7 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -15,8 +15,7 @@ on: jobs: run_flake8: - if: ${{ github.ref == 'refs/heads/1.7' }} - name: Run pytest-flake8 against code tree + name: Run flake8 against code tree runs-on: ubuntu-latest steps: - name: checkout code tree @@ -65,7 +64,7 @@ jobs: env: PYTHONPATH: ${{ github.workspace }}/src run: | - pytest -m flake8 --flake8 --log-level=error + python3 -m flake8 run_pylint: name: Run pylint against code tree