Skip to content
.flakerules.toml 3.78 KiB
Newer Older
[tool.flakeheaven.plugins]
mccabe = [
	"+C",
]
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*",

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

Dom Sekotill's avatar
Dom Sekotill committed
	# DISABLE "missing whitespace around arithmetic operator"
	"-E226",

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

	# DISABLE "Multiple statements on one line (def)"
	# Doesn't work well with @overload definitions
	"-E704",
]
pyflakes = [
	# Most pyflakes tests are either discovered by mypy, or fixed automatically
	# by "isort" and "unimport"; the following are the remaining useful checks
	"-*",

	# 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",
]
flake8-docstrings = [
	## Missing Docstrings
	"+D1*",

	# 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",

	# Whitespace Issues
	"+D2*",

	# 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",

	# 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-sfs = [
	# ENABLE "String literal formatting using percent operator."
	# ENABLE "Bytes literal formatting using percent operator."
	"+SFS1*",
]
flake8-bugbear = [
	# The bulk of bugbear's checks are useful
	"+B0*",

	# 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 "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-print = [
	"+T*",
]
flake8-return = [
	"+R*",
]

[tool.flakeheaven.exceptions."**/__init__.py"]
docstrings = [
	# DISABLE "Missing docstring in public package"
	# Sometimes we want package docstrings, other times not.
	# TODO(dom.sekotill): Verify this
	"-D104",
]

[tool.flakeheaven.exceptions."**/__main__.py"]
docstrings = [
	# DISABLE "Missing docstring in public module"
	# I don't consider __main__ to be a public module, it serves the same
	# function in packages as `if __name__ == "__main__":` in modules.
	"-D100",
]
pycodestyle = [
	# DISABLE "Multiple statements on one line (semicolon)"
	# __main__ modules SHOULD simply import an entrypoint and call it.
	# One-lining it can look a little more elegant than three (including
	# a blank line between imports and code!)
	"-E702",
]

[tool.flakeheaven.exceptions."**/_*.py"]
flake8-docstrings = [
	"-D1*",
]

[tool.flakeheaven.exceptions."tests/"]
flake8-docstrings = [
	# DISABLE "Missing docstring in public module"
	# Test modules are not public modules
	"-D100",
]

[tool.flakeheaven.exceptions."README.md"]
flake8-docstrings = ["-*"]

[tool.flakeheaven.exceptions."doc/*"]
flake8-docstrings = ["-*"]