Skip to content

Commit

Permalink
Fix noqa lints and add to tox/CI
Browse files Browse the repository at this point in the history
The PIE codes apparently suffer from the incorrect filtering
dynamic described in the flake8-noqa README. So, just adding the
plugin to reqts-flake8.txt is not an option.

So, it's set up just as an informative CI step in Azure Pipelines
for now.
  • Loading branch information
bskinn committed Feb 5, 2021
1 parent 468141c commit 8692e8f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 4 deletions.
18 changes: 18 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,3 +202,21 @@ stages:
- script: if [[ $( git status | grep modified | wc -l ) -ne 0 ]]; then exit 1; fi
displayName: Fail if md-toc modified CONTRIBUTING

- job: noqa_info
displayName: Report flake8-noqa results for info (never fails)

pool:
vmImage: 'Ubuntu-latest'

steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.9'

- script: pip install tox flake8-noqa -r requirements-flake8.txt
displayName: Install requirements

- script: tox -e flake8-noqa
displayName: Run never-fail flake8 with noqa check


1 change: 0 additions & 1 deletion requirements-flake8.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ flake8-docstrings>=1.3.1
flake8-eradicate
flake8-implicit-str-concat
flake8-import-order
flake8-noqa
flake8-pie
flake8-rst-docstrings
pep8-naming
2 changes: 1 addition & 1 deletion src/sphobjinv/cli/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ def yesno_prompt(prompt):
"""
resp = ""
while not (resp.lower() == "n" or resp.lower() == "y"):
resp = input(prompt) # noqa: S322
resp = input(prompt)
return resp
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_cli_invocations(self, cmd):
runargs = shlex.split(cmd)
runargs.append("--help")

out = sp.check_output(" ".join(runargs), shell=True).decode() # noqa: S602,S603
out = sp.check_output(" ".join(runargs), shell=True).decode() # noqa: S602

assert "sphobjinv" in out
assert "suggest" in out
Expand Down Expand Up @@ -180,7 +180,7 @@ def test_cli_convert_various_pathargs(

decomp_cmp_test(full_dst_path)

@pytest.mark.timeout(CLI_TEST_TIMEOUT * 50 * 3) # noqa: F821
@pytest.mark.timeout(CLI_TEST_TIMEOUT * 50 * 3)
@pytest.mark.testall
def test_cli_convert_cycle_formats(
self,
Expand Down
7 changes: 7 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ deps=-rrequirements-flake8.txt
commands=
python -c 'import sys, colorama; from flake8.main.cli import main; colorama.init(); sys.argv = ["flake8", "conftest.py", "tests", "src"]; main()'

[testenv:flake8-noqa]
skip_install=True
deps=-rrequirements-flake8.txt
commands=
pip install flake8-noqa
flake8 --color=never --exit-zero conftest.py tests src

[testenv:interrogate]
skip_install=True
deps=interrogate
Expand Down

0 comments on commit 8692e8f

Please sign in to comment.