Commit 35249ff7 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Code quality and development changes

A large amorphous commit including *pre-commit* QA hooks running
a variety of checks and the changes necessary to pass those checks.
parent 9581b712
Loading
Loading
Loading
Loading

.editorconfig

0 → 100644
+10 −0
Original line number Diff line number Diff line
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab

[*.{yml,yaml}]
indent_style = space
+4 −0
Original line number Diff line number Diff line
# Standard python boilerplate
*.py[co]

# Never pin dependencies in source code
requirements*.txt

# Setuptools
.eggs
*.egg-info
*.dist-info
build/
dist/

+57 −0
Original line number Diff line number Diff line
repos:

- repo: meta
  hooks:
  - id: check-hooks-apply

- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v2.3.0
  hooks:
  - id: check-added-large-files
  - id: check-byte-order-marker
  - id: check-case-conflict
  - id: check-merge-conflict
  - id: check-yaml
  - id: debug-statements
  - id: end-of-file-fixer
  - id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
  rev: v1.5.1
  hooks:
  - id: python-no-eval
  - id: python-no-log-warn
  - id: python-use-type-annotations

- repo: https://github.com/hakancelik96/unimport
  rev: v0.2.7
  hooks:
  - id: unimport
    args: [--remove]

- repo: https://github.com/timothycrosley/isort
  rev: 4.3.21-2
  hooks:
  - id: isort

- repo: https://gitlab.com/pycqa/flake8
  rev: 3.8.3
  hooks:
  - id: flake8
    args: ["--config=setup.cfg"]
    additional_dependencies:
    - flake8-commas
    - flake8-copyright
    - flake8-bugbear
    - flake8-docstrings
    - flake8-print
    - flake8-requirements
    - flake8-return
    - flake8-sfs
    - flake8-tabs

- repo: https://code.kodo.org.uk/dom/pre-commit-pylint
  rev: v0.1
  hooks:
  - id: pylint
    args: [--extras=test, --fail-under=9.0]
+113 −20
Original line number Diff line number Diff line
@@ -28,21 +28,23 @@ python_requires = >= 3.6
packages = find:
setup_requires =
  setuptools >= 40.6
  setuptools-lint >= 0.6
install_requires =
  anyio >=1.0
tests_require =
  anyio[curio]
  coverage <5
  mocket[speedups]
  nose2[coverage_plugin]
test_suite = nose2.collector.collector
lint_rcfile = setup.cfg

[options.packages.find]
include =
  wpa_supplicant

[options.extras_require]
test =
  anyio[curio]
  coverage <5
  mocket[speedups]
  nose2[coverage_plugin]
dev =
  %(test)s
  pre-commit

[unittest]
start-dir = tests
verbose = True
@@ -84,13 +86,111 @@ always-on = True
[log-capture]
always-on = True

[pylint]
[isort]
force_single_line=true

[flake8]
max-line-length = 92
max-doc-length = 92
copyright-check = true
copyright-min-file-size = 200
use-flake8-tabs = true
blank-lines-indent = never
indent-tabs-def = 1
format = pylint
select = C,D,E,ET,F,SFS,T,W,WT

; Speedup by pruning potentially large trees that will have nothing of interest
; in them.
exclude =
  __pycache__
  .*

per-file-ignores =
  setup.py: D100, E702
  tests/*.py: D100, C801
  **/__init__.py: D104
  **/__main__.py: D100, E702

ignore =
  ;[ Missing docstring in public method ]
  ; Handled by pylint, which does it better
  D102

  ;[ Missing docstring in magic method ]
  ; Magic/dunder methods are well-known
  D105

  ;[ Misisng docstring in __init__ ]
  ; Document basic construction in the class docstring
  D107

  ;[ One-line docstring should fit on one line with quotes ]
  ; Prefer top-and-bottom style always
  D200

  ;[ Docstring should be indented with spaces, not tabs ]
  ; Tabs, absolutely always
  D206

  ;[ Use u""" for Unicode docstrings ]
  ; This must be for Python 2?
  D302

  ;[ First line should end with a period ]
  ; First line should *NEVER* end with a period
  D400

  ;[ First line should be in the imperative mood ]
  ; I like this for functions and methods, not for properties. This stands until
  ; pydocstyle splits a new code for properties or flake8 adds some way of
  ; filtering codes with line regexes like golangci-lint.
  D401

  ;[ Line too long ]
  ; Prefer B950 implementation
  E501

  ;[ Line break before binary operator ]
  ; Not considered current
  W503

  ;[ Format-method string formatting ]
  ; Allow this style
  SFS201

  ;[ f-string string formatting ]
  ; Allow this style
  SFS301

include =
  ;[ First word of the docstring should not be This ]
  D404

  ; flake8-bugbear plugin
  ; B950 is a replacement for E501
  B0 B903 B950

[pylint.MASTER]
persistent=yes
ignore =
  __pycache__
  .*

[pylint.BASIC]
const-rgx = (([A-Z_][A-Z0-9_]*)|(_[A-Za-z0-9_]+))$
good-names = db, i, a, b, ab, t

[pylint.REPORTS]
reports = no
output-format = colorized

[pylint.FORMAT]
indent-string = '\t'

[pylint.DESIGN]
max-attributes = 10
const-rgx = [A-Z][A-Z0-9_]{2,30}$|_{1,2}[a-z][a-z0-9_]{2,30}$

[pylint.MESSAGES CONTROL]
disable =
  bad-continuation,
  ; Would be nice to not disable but it is bugged; it trys to interpret tabs as
@@ -100,12 +200,5 @@ disable =
  ; Would be nice to have enabled for *code* but not for comments or
  ; multi-line strings.

  bad-mcs-classmethod-argument,
  ; PyLint 2 seems to have fallen in line with an overstrict interpretation of 
  ; PEP-8 and no longer thinks classmethods on metaclasses should use 'mcs' as 
  ; the first argument. I disagree with this, especially in the __new__ method 
  ; as instances of 'mcs' are classes, so should be named 'cls'.
  ; https://github.com/PyCQA/pylint/issues/2028


; vim: sw=2 sts=2 expandtab
+3 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
"""Setuptools entrypoint"""

from setuptools import setup

setup()
Loading