From e25589dbcc5b2455bf9f0b49cf2083bb0eae449f Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 6 Nov 2021 21:00:24 +0100 Subject: [PATCH] GitHub Action to lint Python code Because Travis Ci is on vacation. --- .github/workflows/lint_python.yml | 23 +++++++++++++++++++++++ pytest.ini | 2 +- setup.py | 2 +- subliminal/core.py | 2 +- 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/lint_python.yml diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml new file mode 100644 index 000000000..10b61db45 --- /dev/null +++ b/.github/workflows/lint_python.yml @@ -0,0 +1,23 @@ +name: lint_python +on: [pull_request, push] +jobs: + lint_python: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install --upgrade pip wheel + - run: pip install bandit black codespell flake8 flake8-2020 flake8-bugbear + flake8-comprehensions isort mypy pytest pyupgrade safety + - run: bandit --recursive --skip B101,B105,B106,B303,B314,B404,B405,B410,B603 . + - run: black --check . || true + - run: codespell --ignore-words-list=nd,reacher,serie --skip="*.yaml" + - run: flake8 --ignore=B001,C401,C405,C408,C416,E122,E127,E128,E226,E265,E402,E722,E741,F401,R502,R503,R504,W504,W605 + --count --max-complexity=36 --max-line-length=120 --show-source --statistics . + - run: isort --check-only --profile black . || true + - run: pip install -r dev-requirements.txt -r requirements.txt + - run: mkdir --parents --verbose .mypy_cache + - run: mypy --ignore-missing-imports --install-types --non-interactive . || true + - run: pytest --doctest-modules . || true + - run: shopt -s globstar && pyupgrade --py36-plus **/*.py || true + - run: safety check diff --git a/pytest.ini b/pytest.ini index cfa3e35e5..b4bc971ef 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,6 @@ [pytest] norecursedirs = build dist env .tox .eggs -addopts = --pep8 --flakes --doctest-glob='*.rst' +addopts = --doctest-glob='*.rst' pep8maxlinelength = 120 pep8ignore = docs/conf.py ALL diff --git a/setup.py b/setup.py index b33a29778..ccc1cdab7 100644 --- a/setup.py +++ b/setup.py @@ -34,7 +34,7 @@ def find_version(*file_paths): if sys.version_info < (3, 2): install_requirements.append('futures>=3.0') -test_requirements = ['sympy', 'vcrpy>=1.6.1', 'pytest', 'pytest-pep8', 'pytest-flakes', 'pytest-cov'] +test_requirements = ['sympy', 'vcrpy>=1.6.1', 'pytest', 'pytest-flakes', 'pytest-cov'] if sys.version_info < (3, 3): test_requirements.append('mock') diff --git a/subliminal/core.py b/subliminal/core.py index b6af6d924..70a4bf40b 100644 --- a/subliminal/core.py +++ b/subliminal/core.py @@ -400,7 +400,7 @@ def scan_archive(path): # Get filename and file size from RAR rar = RarFile(path) - # check that the rar doesnt need a password + # check that the rar doesn't need a password if rar.needs_password(): raise ValueError('Rar requires a password')