Verified Commit 6b31ce3c authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

.editorconfig

0 → 100644
+11 −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,cfg}]
indent_style = space
indent_size = 2

.gitignore

0 → 100644
+7 −0
Original line number Diff line number Diff line
*.py[co]

*.tar
*.tar.*
*.whl

*_cache

.gitlint

0 → 100644
+11 −0
Original line number Diff line number Diff line
[general]
ignore=body-trailing-whitespace,body-is-missing
regex-style-search=True

[author-valid-email]
regex=@[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9](\.[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])+$

[ignore-body-lines]
regex="^(Fixes|Closes):?\s+[#][0-9]+"

# vim:ft=cfg
+90 −0
Original line number Diff line number Diff line
default_stages: [commit]
repos:

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

- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.6.0
  hooks:
  - id: check-added-large-files
  - id: check-case-conflict
  - id: check-merge-conflict
  - id: check-toml
  - id: check-yaml
  - id: debug-statements
  - id: destroyed-symlinks
  - id: end-of-file-fixer
    stages: [commit, manual]
  - id: fix-byte-order-marker
  - id: fix-encoding-pragma
    args: [--remove]
  - id: mixed-line-ending
    args: [--fix=lf]
    stages: [commit, manual]
  - id: trailing-whitespace
    exclude_types: [markdown, plain-text]
    stages: [commit, manual]

- repo: https://github.com/jorisroovers/gitlint
  rev: v0.19.1
  hooks:
  - id: gitlint

- repo: https://code.kodo.org.uk/dom/pre-commit-hooks
  rev: v0.6.1
  hooks:
  - id: check-executable-modes
  - id: check-for-squash
  - id: copyright-notice
    args: [--min-size=1000]
    files: ^kodo/.*
    stages: [commit, manual]
  - id: protect-first-parent

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

- repo: https://github.com/hakancelikdev/unimport
  rev: 1.2.1
  hooks:
  - id: unimport
    args: [--remove]
    types: []
    types_or: [python, pyi]
    additional_dependencies: [libcst >=0.4.0]
    stages: [commit, manual]

- repo: https://github.com/pycqa/isort
  rev: 5.13.2
  hooks:
  - id: isort
    stages: [commit, manual]

- repo: https://github.com/asottile/add-trailing-comma
  rev: v3.1.0
  hooks:
  - id: add-trailing-comma
    args: [--py36-plus]
    types: []
    types_or: [python, pyi]
    stages: [commit, manual]

- repo: https://github.com/astral-sh/ruff-pre-commit
  rev: v0.6.2
  hooks:
  - id: ruff
    args: [--fix, --unsafe-fixes]

- repo: https://github.com/pre-commit/mirrors-mypy
  rev: v1.11.2
  hooks:
  - id: mypy
    args: [--follow-imports=silent, kodo]
    pass_filenames: false

.ruff.toml

0 → 100644
+175 −0
Original line number Diff line number Diff line
line-length = 92
indent-width = 1  # Used for line length violations

[lint]
select = [
	# pyflakes
	# --------

	# ENABLE "Undefined name %s in __all__"
	"F822",

	# ENABLE "Local variable %s ... referenced before assignment"
	"F823",

	# ENABLE "Local variable %s is assigned to but never used"
	"F841",

	# ENABLE "raise NotImplemented should be raise NotImplementedError"
	# mypy has particular trouble with this one:
	# https://github.com/python/mypy/issues/5710
	"F901",

	# pycodestyle
	# -----------

	# Warnings not considered, many are not relevant to Python ~=3.9 and will
	# cause syntax errors anyway, others concern whitespace which is fixed by
	# a pre-commit hook.
	"E",

	# mccabe
	# ------

	"C90",

	# pydocstyle
	# ----------

	# Missing docstrings
	"D1",

	# Whitespace Issues
	"D2",

	# ENABLE "Use “””triple double quotes”””"
	"D300",

	# First line should be descriptive, imperative and capitalised
	"D401", "D402", "D403", "D404",

	# ENABLE "Function/Method decorated with @overload shouldn’t contain a docstring"
	"D418",

	# flake8-bugbear
	# --------------

	# The bulk of bugbear's checks are useful
	"B0",

	# Various others
	# --------------

	"UP", "BLE", "FBT", "A", "COM", "C4", "DTZ", "ISC", "LOG", "G", "PIE", "T",
	"Q", "RSE", "RET", "SLF", "SLOT", "SIM", "TD", "ANN", #"FA",

	# Nice to have, needs fixing in several places though...
	# "EM", "TCH", "PTH", "PGH",
]
ignore = [
	# pycodestyle
	# -----------

	# DISABLE "Indentation contains mixed spaces and tabs"
	# Will cause a syntax error if critical, otherwise in docstrings it is
	# sometimes nice to use different indentation for "outer" (code) indentation
	# and "inner" (documentation) indentation.
	"E101",

	# DISABLE "Continuation line missing indentation or outdented"
	# "E122",

	# DISABLE "Missing whitespace around bitwise or shift operator"
	"E227",

	# DISABLE "missing whitespace around arithmetic operator"
	"E226",

	# DISABLE "Line too long"
	# Prefer B950 implementation
	"E501",

	# DISABLE "Multiple statements on one line (colon)"
	"E701",

	# DISABLE "Multiple statements on one line (def)"
	# Doesn't work well with @overload definitions
	# "E704",

	# pydocstyle
	# ----------

	# DISABLE "Missing docstring in magic method"
	# Magic/dunder methods are well-known
	"D105",

	# DISABLE "Missing docstring in __init__"
	# Document basic construction in the class docstring
	"D107",

	# DISABLE "One-line docstring should fit on one line with quotes"
	# Prefer top-and-bottom style always
	"D200",

	# DISABLE "1 blank line required before class docstring"
	"D203",

	# DISABLE "Docstring should be indented with spaces, not tabs"
	# Tabs, absolutely always
	"D206",

	# DISABLE "Multi-line docstring summary should start at the first line"
	"D212",

	# flake8-bugbear
	# --------------

	# DISABLE "Do not use mutable data structures for argument defaults [...]"
	# Would be nice if could take into account use as a non-mutable type
	"B006",

	# DISABLE "Loop control variable `self` overrides iterable it iterates"
	# Bit buggy, and type checker should catch it.
	"B020",

	# DISABLE "release is an empty method in an abstract base class, [...]"
	# Until abstract methods are optional, empty optional "abstract" methods
	# stay
	"B027",

	# Use named-tuples (preferably class based) for data-only classes
	# "B903",

	# Replacement for E501
	# "B950",

	# flake8-return
	# -------------

	# DISABLE "missing explicit return at the end of function able to return
	# non-None value"
	# Mypy will report this, plugin also cannot do exhaustiveness check of match
	# block, leading to false-positives.
	"RET503",

	# DISABLE "Missing type annotation for `%` in {method|classmethod}"
	# Don't type 'self' or 'cls'
	"ANN101", "ANN102",

	# DISABLE "Boolean positional value in function call"
	# Too many stdlib functions take a single positional-only boolean. ruff
	# can't interpret function signatures to ignore these and doesn't understand
	# types to allow-list methods.
	"FBT003",

	# DISABLE "Implicitly concatenated string literals over multiple lines"
	# It sometimes looks better to do this than introduce unecessary
	# parentheses.
	"ISC002",

	# Unfortunately a lot of single quotes strings used in this project already
	"Q000",
]

[lint.per-file-ignores]
"test*" = ["D1"]