Skip to content

Commit

Permalink
Issue #241 - Add linters and checks to match Core
Browse files Browse the repository at this point in the history
Add devel dependencies, linters, and check pipeline to match Core. This
currently includes black, mypy, flake8, and other pre-commit pipelines.
  • Loading branch information
MJJoyce committed Jul 26, 2023
1 parent 752a262 commit cd00594
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,45 @@ repos:
rev: v4.0.1
hooks:
- id: trailing-whitespace
exclude: "build/"
- id: end-of-file-fixer
exclude: "build/"
- id: check-merge-conflict
exclude: "build/"
- id: debug-statements
exclude: "build/"

- repo: https://github.com/asottile/reorder_python_imports
rev: v2.6.0
hooks:
- id: reorder-python-imports
files: ^src/|test/

- repo: local
hooks:
- id: mypy
name: mypy
entry: mypy --namespace-packages --package ait.gui
language: system
pass_filenames: false
exclude: "bin/"

- repo: local
hooks:
- id: black
name: black
entry: black
files: ^src/|test/
language: system
types: [python]

- repo: local
hooks:
- id: flake8
name: flake8
entry: flake8 ait
language: system
pass_filenames: false

- repo: local
hooks:
Expand Down
26 changes: 21 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,24 @@ ait-core = ">=2.3.0"
greenlet = "1.1.3"

[tool.poetry.dev-dependencies]
sphinx = '>= 4.2'
sphinx-rtd-theme = '*'
sphinxcontrib-httpdomain = '*'
sphinx-js = '*'
pre-commit = '*'
black = '*'
flake8 = '*'
pyproject-flake8 = '^0.0.1-alpha.2'
flake8-bugbear = '*'
pep8-naming = '*'
mypy = '*'
types-PyYAML = '*'
types-requests = '*'
types-setuptools = '*'
pydocstyle = '*'
coverage = '*'
pytest = '*'
pytest-cov = '*'
pytest-watch = '*'
pytest-xdist = '*'
pre-commit = '*'
sphinx = '>= 4.2'
sphinx-rtd-theme = '*'
sphinxcontrib-httpdomain = '*'
tox = '>= 3.8 < 4.0'
twine = '^3.4.2'
65 changes: 65 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[build_sphinx]
source-dir = doc/source
build-dir = doc/build
all_files = 1


[tool:pytest]
junit_family=xunit1
addopts = --cov=ait
filterwarnings =
ignore::DeprecationWarning:ait.core.*:

[coverage:run]
omit = */_version.py,*/__init__.py,*/bin/*,*/test/*

[flake8]
extend-exclude = versioneer.py,_version.py,docs,doc,tests,test,setup.py

# Ignoring:
# E203 prevents flake8 from complaining about whitespace around slice
# components. Black formats per PEP8 and flake8 doesn't like some of
# this.
#
# E501 prevents flake8 from complaining line lengths > 79. We will use
# flake8-bugbear's B950 to handle line length lint errors. This trips
# when a line is > max-line-length + 10%.
#
# E402 prevents flake8 complaining about module level imports not appearing
# at the top of a file. We need to run gevent monkeypatching which triggers
# this on every import where that's the case.
extend-ignore = E203, E501, E402

# Selects following test categories:
# D: Docstring errors and warnings
# E, W: PEP8 errors and warnings
# F: PyFlakes codes
# N: PEP8 Naming plugin codes
# B: flake8-bugbear codes
# B***: Specific flake8-bugbear opinionated warnings to trigger
# B902: Invalid first argument used for method. Use self for instance
# methods, and cls for class methods
# B903: Use collections.namedtuple (or typing.NamedTuple) for data classes
# that only set attributes in an __init__ method, and do nothing else.
# B950: Line too long. This is a pragmatic equivalent of pycodestyle's
# E501: it considers "max-line-length" but only triggers when the value
# has been exceeded by more than 10%.
select = E,F,N,W,B,B902,B903,B950


[mypy]

[mypy-gevent.*]
ignore_missing_imports = True

[mypy-zmq.*]
ignore_missing_imports = True

[mypy-bottle.*]
ignore_missing_imports = True

[mypy-jsonschema.*]
ignore_missing_imports = True

[mypy-geventwebsocket.*]
ignore_missing_imports = True

0 comments on commit cd00594

Please sign in to comment.