Skip to content

chore: pin linter dependencies #198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
# - examples
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 2.7
architecture: ${{ matrix.platform.architecture }}
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
# - examples
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
architecture: ${{ matrix.platform.architecture }}
Expand Down
4 changes: 3 additions & 1 deletion codebuild/python2.7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 2.7.17
- pyenv local 2.7.17
- pip install tox tox-pyenv
- tox
4 changes: 3 additions & 1 deletion codebuild/python3.6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 3.6.15
- pyenv local 3.6.15
- pip install tox tox-pyenv
- tox
4 changes: 3 additions & 1 deletion codebuild/python3.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ phases:
python: latest
build:
commands:
- pip install tox
- pyenv install 3.8.12
- pyenv local 3.8.12
- pip install tox tox-pyenv
- tox
16 changes: 16 additions & 0 deletions dev_requirements/linter-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
bandit==1.7.0
black==21.12b0
doc8==0.10.1
flake8==4.0.1
flake8-bugbear==21.11.29
flake8-docstrings==1.6.0
flake8-isort==4.1.1
flake8-print==4.0.0
isort==5.10.1
pydocstyle==3.0.0
pyflakes==2.4.0
pylint==2.12.2
readme_renderer==32.0
seed-isort-config==2.2.0
vulture==2.3
sphinx==4.4.0
4 changes: 2 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_version():
return _release


project = u"dynamodb-encryption-sdk-python"
project = u"dynamodb-encryption-sdk-python" # pylint: disable=redundant-u-string-prefix
version = get_version()
release = get_release()

Expand All @@ -53,7 +53,7 @@ def get_version():
source_suffix = ".rst" # The suffix of source filenames.
master_doc = "index" # The master toctree document.

copyright = u"%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin
copyright = u"%s, Amazon" % datetime.now().year # pylint: disable=redefined-builtin,redundant-u-string-prefix

# List of directories, relative to source directory, that shouldn't be searched
# for source files.
Expand Down
1 change: 1 addition & 0 deletions examples/test/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ disable =
# pylint does not recognize this
duplicate-code, # tests for similar things tend to be similar
redefined-outer-name, # raises false positives with fixtures
consider-using-f-string,

[DESIGN]
max-args = 10
Expand Down
1 change: 1 addition & 0 deletions src/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ disable =
useless-object-inheritance,
raise-missing-from,
super-with-arguments,
consider-using-f-string

[BASIC]
# Allow function names up to 50 characters
Expand Down
3 changes: 3 additions & 0 deletions test/pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ disable =
protected-access, # raised when calling _ methods
redefined-outer-name, # raised when using pytest-mock
unused-argument, # raised when patches and fixtures are needed but not called
unspecified-encoding,
# All below are disabled because we need to support Python 2
useless-object-inheritance,
raise-missing-from,
super-with-arguments,
consider-using-f-string,
redundant-u-string-prefix,

[DESIGN]
max-args = 10
Expand Down
5 changes: 4 additions & 1 deletion test/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
hypothesis>=5.0.0,<6.0.0;python_version>='3'
hypothesis==4.57.1;python_version=='2.7'
mock
moto>=1.3.8
moto>=1.3.8;python_version>='3'
# must be less than 2.2.x as Moto removed support for python2 as of moto 2.2.x.
# https://github.com/spulec/moto/issues/3612
moto>=1.3.8,<2.2.0;python_version=='2.7'
pytest>=3.4.0
pytest-cov
pytest-mock
Expand Down
2 changes: 1 addition & 1 deletion test/unit/material_providers/test_aws_kms.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def test_loaded_key_infos():
[
pytest.param(val, id=str(val))
for val in all_possible_combinations_kwargs(
dict(),
{},
dict(botocore_session=botocore.session.Session()),
dict(grant_tokens=("sdvoaweih", "auwshefiouawh")),
dict(material_description={"asoiufeoia": "soajfijewi"}),
Expand Down
35 changes: 14 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,7 @@ commands =
[testenv:flake8]
basepython = python3
deps =
flake8
flake8-docstrings
flake8-isort
# https://github.com/PyCQA/pydocstyle/issues/375
pydocstyle<4.0.0
# https://github.com/JBKahn/flake8-print/pull/30
flake8-print>=3.1.0
-rdev_requirements/linter-requirements.txt
commands =
flake8 \
src/dynamodb_encryption_sdk/ \
Expand All @@ -238,7 +232,7 @@ commands =
# Ignore D101-107 docstring requirements for tests
# E203 is not PEP8 compliant https://github.com/ambv/black#slices
# W503 is not PEP8 compliant https://github.com/ambv/black#line-breaks--binary-operators
--ignore F811,D101,D102,D103,D107,E203,W503 \
--ignore F811,D101,D102,D103,D107,E203,W503,B011 \
test/

[testenv:flake8-examples]
Expand All @@ -261,8 +255,7 @@ commands =
basepython = python3
deps =
{[testenv]deps}
pyflakes
pylint
-rdev_requirements/linter-requirements.txt
commands =
pylint \
--rcfile=src/pylintrc \
Expand Down Expand Up @@ -291,7 +284,7 @@ commands =
[testenv:blacken-src]
basepython = python3
deps =
black
-rdev_requirements/linter-requirements.txt
commands =
black --line-length 120 \
src/dynamodb_encryption_sdk/ \
Expand Down Expand Up @@ -324,9 +317,8 @@ commands = seed-isort-config

[testenv:isort]
basepython = python3
# We need >=5.0.0 because
# several configuration settings changed with 5.0.0
deps = isort>=5.0.0
deps =
-rdev_requirements/linter-requirements.txt
commands = isort \
src \
test \
Expand Down Expand Up @@ -366,27 +358,28 @@ commands =
basepython = python3
whitelist_externals = {[testenv:resetdocs]whitelist_externals}
deps =
sphinx
doc8
commands =
-rdev_requirements/linter-requirements.txt
commands =
{[testenv:resetdocs]commands}
doc8 doc/index.rst doc/lib/ README.rst CHANGELOG.rst


[testenv:readme]
basepython = python3
deps = readme_renderer
deps =
-rdev_requirements/linter-requirements.txt
commands = python setup.py check -r -s

[testenv:bandit]
basepython = python3
deps = bandit
deps =
-rdev_requirements/linter-requirements.txt
commands = bandit -r src/dynamodb_encryption_sdk/

# Prone to false positives: only run independently
[testenv:vulture]
basepython = python3
deps = vulture
deps =
-rdev_requirements/linter-requirements.txt
commands = vulture src/dynamodb_encryption_sdk/

[testenv:linters]
Expand Down