max-lint 0.6.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- max_lint/__init__.py +1 -0
- max_lint/cli.py +70 -0
- max_lint/config.py +154 -0
- max_lint/lint.py +131 -0
- max_lint/py.typed +0 -0
- max_lint/pytest_step.py +88 -0
- max_lint/style/coverage.toml +2 -0
- max_lint/style/docutils.conf +3 -0
- max_lint/style/flake8.ini +15 -0
- max_lint/style/formatters.toml +6 -0
- max_lint-0.6.0.dist-info/METADATA +307 -0
- max_lint-0.6.0.dist-info/RECORD +16 -0
- max_lint-0.6.0.dist-info/WHEEL +4 -0
- max_lint-0.6.0.dist-info/entry_points.txt +2 -0
- max_lint-0.6.0.dist-info/licenses/LICENSE +202 -0
- max_lint-0.6.0.dist-info/licenses/NOTICE +2 -0
max_lint/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""max-lint command line tool."""
|
max_lint/cli.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Command line entry point for max-lint."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
import tempfile
|
|
8
|
+
from importlib.metadata import version
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from max_lint.config import ConfigError, load_config
|
|
12
|
+
from max_lint.lint import TOOL_ENVIRONMENT, lint_commands
|
|
13
|
+
from max_lint.pytest_step import FAIL_UNDER, pytest_command, run_tests
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def run_commands(commands: list[list[str]]) -> int:
|
|
17
|
+
"""
|
|
18
|
+
Run each command in order, stopping at the first one that fails.
|
|
19
|
+
|
|
20
|
+
:param commands: argument lists to run from the current directory.
|
|
21
|
+
:return: 0 when every command succeeds, otherwise 1.
|
|
22
|
+
"""
|
|
23
|
+
for command in commands:
|
|
24
|
+
if subprocess.run(command, check=False, env={**os.environ, **TOOL_ENVIRONMENT}).returncode != 0:
|
|
25
|
+
return 1
|
|
26
|
+
|
|
27
|
+
return 0
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def main(argv: list[str] | None = None) -> int:
|
|
31
|
+
"""
|
|
32
|
+
Run the ``max-lint`` command.
|
|
33
|
+
|
|
34
|
+
:param argv: arguments to parse; defaults to ``sys.argv[1:]``.
|
|
35
|
+
:return: the process exit code: 0 on success, 1 when a tool fails, 2 on a configuration error.
|
|
36
|
+
"""
|
|
37
|
+
parser = argparse.ArgumentParser(
|
|
38
|
+
prog="max-lint",
|
|
39
|
+
description="Run black, isort, flake8, mypy and pytest with a single shared configuration.",
|
|
40
|
+
)
|
|
41
|
+
parser.add_argument("--version", action="version", version=f"%(prog)s {version('max-lint')}")
|
|
42
|
+
parser.add_argument("--check", action="store_true", help="check formatting with black and isort without rewriting files")
|
|
43
|
+
subcommands = parser.add_subparsers(dest="command")
|
|
44
|
+
lint_parser = subcommands.add_parser("lint", help="format with black and isort, then check with flake8 and mypy")
|
|
45
|
+
lint_parser.add_argument(
|
|
46
|
+
"--check",
|
|
47
|
+
action="store_true",
|
|
48
|
+
default=argparse.SUPPRESS,
|
|
49
|
+
help="check formatting with black and isort without rewriting files",
|
|
50
|
+
)
|
|
51
|
+
subcommands.add_parser("test", help=f"run pytest with branch coverage and a {FAIL_UNDER}%% floor")
|
|
52
|
+
arguments = parser.parse_args(argv)
|
|
53
|
+
|
|
54
|
+
with tempfile.TemporaryDirectory() as scratch_directory:
|
|
55
|
+
scratch = Path(scratch_directory)
|
|
56
|
+
lint = arguments.command != "test"
|
|
57
|
+
test = arguments.command != "lint"
|
|
58
|
+
|
|
59
|
+
try:
|
|
60
|
+
config = load_config(Path("pyproject.toml"))
|
|
61
|
+
commands = lint_commands(config, check=arguments.check, scratch=scratch) if lint else []
|
|
62
|
+
test_command = pytest_command(config, scratch) if test else []
|
|
63
|
+
except ConfigError as error:
|
|
64
|
+
print(f"max-lint: {error}", file=sys.stderr)
|
|
65
|
+
return 2
|
|
66
|
+
|
|
67
|
+
if run_commands(commands) != 0:
|
|
68
|
+
return 1
|
|
69
|
+
|
|
70
|
+
return run_tests(test_command, scratch) if test else 0
|
max_lint/config.py
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Load the ``[tool.max-lint]`` table that declares what a project owns."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import tomllib
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from black.files import infer_target_version
|
|
9
|
+
|
|
10
|
+
LIST_KEYS = ("paths", "test-paths", "exclude", "coverage-source", "coverage-omit")
|
|
11
|
+
KNOWN_KEYS = (*LIST_KEYS, "per-file-ignores")
|
|
12
|
+
FLAKE8_CODE = re.compile(r"[A-Z]+[0-9]*")
|
|
13
|
+
LOCKED_MYPY_KEYS = (
|
|
14
|
+
"disallow_untyped_defs",
|
|
15
|
+
"allow_untyped_defs",
|
|
16
|
+
"no_disallow_untyped_defs",
|
|
17
|
+
"warn_redundant_casts",
|
|
18
|
+
"no_warn_redundant_casts",
|
|
19
|
+
"no_implicit_optional",
|
|
20
|
+
"implicit_optional",
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ConfigError(Exception):
|
|
25
|
+
"""A missing or invalid project setting; the message names the problem and the fix."""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class Config:
|
|
30
|
+
"""Project settings, with paths relative to the directory of ``pyproject.toml``."""
|
|
31
|
+
|
|
32
|
+
paths: list[str]
|
|
33
|
+
test_paths: list[str]
|
|
34
|
+
exclude: list[str]
|
|
35
|
+
coverage_source: list[str]
|
|
36
|
+
coverage_omit: list[str]
|
|
37
|
+
per_file_ignores: dict[str, list[str]]
|
|
38
|
+
black_target_versions: list[str]
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _is_str_list(value: object) -> bool:
|
|
42
|
+
"""Return whether ``value`` is a list of non-empty strings."""
|
|
43
|
+
return isinstance(value, list) and all(isinstance(item, str) and item for item in value)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def _table(document: dict[str, object], key: str) -> dict[str, object]:
|
|
47
|
+
table = document.get(key, {})
|
|
48
|
+
|
|
49
|
+
if not isinstance(table, dict):
|
|
50
|
+
raise ConfigError(f"'{key}' in pyproject.toml must be a table, for example [{key}].")
|
|
51
|
+
|
|
52
|
+
return table
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _reject_locked_mypy_keys(document: dict[str, object]) -> None:
|
|
56
|
+
"""
|
|
57
|
+
Reject a ``[tool.mypy]`` table or ``[[tool.mypy.overrides]]`` entry that sets a key max-lint fixes, in any spelling mypy accepts.
|
|
58
|
+
|
|
59
|
+
:param document: the parsed ``pyproject.toml``.
|
|
60
|
+
:raises ConfigError: when the mypy tables are malformed or set a locked key.
|
|
61
|
+
"""
|
|
62
|
+
mypy = _table(document, "tool").get("mypy", {})
|
|
63
|
+
overrides = mypy.get("overrides", []) if isinstance(mypy, dict) else None
|
|
64
|
+
|
|
65
|
+
if not isinstance(overrides, list) or not all(isinstance(entry, dict) for entry in overrides):
|
|
66
|
+
raise ConfigError(
|
|
67
|
+
"'mypy' in [tool] must be a table and its 'overrides' a list of tables; write [tool.mypy] and [[tool.mypy.overrides]].",
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
places = [
|
|
71
|
+
("[tool.mypy]", mypy),
|
|
72
|
+
*((f"[[tool.mypy.overrides]] for module {entry.get('module')!r}", entry) for entry in overrides),
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
for place, settings in places:
|
|
76
|
+
for key in settings:
|
|
77
|
+
if key in LOCKED_MYPY_KEYS:
|
|
78
|
+
raise ConfigError(f"{key!r} is set in {place}, but max-lint fixes it; remove it.")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def load_config(pyproject: Path) -> Config:
|
|
82
|
+
"""
|
|
83
|
+
Read and validate the ``[tool.max-lint]`` table of a ``pyproject.toml``.
|
|
84
|
+
|
|
85
|
+
:param pyproject: path to the project's ``pyproject.toml``.
|
|
86
|
+
:return: the validated settings.
|
|
87
|
+
:raises ConfigError: when the file, the table or a key is missing or invalid.
|
|
88
|
+
"""
|
|
89
|
+
try:
|
|
90
|
+
with pyproject.open("rb") as file:
|
|
91
|
+
document = tomllib.load(file)
|
|
92
|
+
except FileNotFoundError:
|
|
93
|
+
raise ConfigError(f"{pyproject} not found; run max-lint from the directory that holds pyproject.toml.") from None
|
|
94
|
+
except tomllib.TOMLDecodeError as error:
|
|
95
|
+
raise ConfigError(f"{pyproject} is not valid TOML ({error}); fix the syntax.") from None
|
|
96
|
+
|
|
97
|
+
table = _table(document, "tool").get("max-lint")
|
|
98
|
+
|
|
99
|
+
if table is None:
|
|
100
|
+
raise ConfigError(f'{pyproject} has no [tool.max-lint] table; add one with paths = ["src"].')
|
|
101
|
+
|
|
102
|
+
if not isinstance(table, dict):
|
|
103
|
+
raise ConfigError("'max-lint' in [tool] must be a table; write it as [tool.max-lint] with paths = [\"src\"].")
|
|
104
|
+
|
|
105
|
+
for key in table:
|
|
106
|
+
if key not in KNOWN_KEYS:
|
|
107
|
+
raise ConfigError(f"unknown key {key!r} in [tool.max-lint]; remove it (known keys: {', '.join(KNOWN_KEYS)}).")
|
|
108
|
+
|
|
109
|
+
if "paths" not in table:
|
|
110
|
+
raise ConfigError("[tool.max-lint] is missing 'paths'; add the source paths, for example paths = [\"src\"].")
|
|
111
|
+
|
|
112
|
+
for key in LIST_KEYS:
|
|
113
|
+
if not _is_str_list(table.get(key, [])):
|
|
114
|
+
raise ConfigError(f"'{key}' in [tool.max-lint] must be a list of non-empty strings.")
|
|
115
|
+
|
|
116
|
+
if not table["paths"]:
|
|
117
|
+
raise ConfigError("'paths' in [tool.max-lint] is empty; list at least one source path.")
|
|
118
|
+
|
|
119
|
+
per_file_ignores = table.get("per-file-ignores", {})
|
|
120
|
+
|
|
121
|
+
if not isinstance(per_file_ignores, dict) or not all(
|
|
122
|
+
glob and _is_str_list(codes) and all(FLAKE8_CODE.fullmatch(code) for code in codes)
|
|
123
|
+
for glob, codes in per_file_ignores.items()
|
|
124
|
+
):
|
|
125
|
+
raise ConfigError(
|
|
126
|
+
"'per-file-ignores' in [tool.max-lint] must be a table of non-empty path glob to a list of flake8 codes such as \"D100\".",
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
for glob in per_file_ignores:
|
|
130
|
+
if Path(glob).is_absolute() or glob.endswith("/"):
|
|
131
|
+
raise ConfigError(
|
|
132
|
+
f"'per-file-ignores' in [tool.max-lint] has the glob {glob!r}, which matches no file; "
|
|
133
|
+
"use a path relative to pyproject.toml that ends in a file name or pattern.",
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
for key in ("paths", "test-paths"):
|
|
137
|
+
for path in table.get(key, []):
|
|
138
|
+
if not (pyproject.parent / path).exists():
|
|
139
|
+
raise ConfigError(f"'{key}' in [tool.max-lint] lists {path!r}, which does not exist; fix or remove it.")
|
|
140
|
+
|
|
141
|
+
if not isinstance(_table(document, "project").get("requires-python", ""), str):
|
|
142
|
+
raise ConfigError("'requires-python' in [project] must be a string, for example \">=3.13\".")
|
|
143
|
+
|
|
144
|
+
_reject_locked_mypy_keys(document)
|
|
145
|
+
|
|
146
|
+
return Config(
|
|
147
|
+
paths=table["paths"],
|
|
148
|
+
test_paths=table.get("test-paths", []),
|
|
149
|
+
exclude=table.get("exclude", []),
|
|
150
|
+
coverage_source=table.get("coverage-source", []),
|
|
151
|
+
coverage_omit=table.get("coverage-omit", []),
|
|
152
|
+
per_file_ignores=per_file_ignores,
|
|
153
|
+
black_target_versions=[version.name.lower() for version in infer_target_version(document) or []],
|
|
154
|
+
)
|
max_lint/lint.py
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Build the black, isort, flake8 and mypy commands that apply the bundled style."""
|
|
2
|
+
|
|
3
|
+
import contextlib
|
|
4
|
+
import os
|
|
5
|
+
import re
|
|
6
|
+
import stat
|
|
7
|
+
import sys
|
|
8
|
+
from dataclasses import replace
|
|
9
|
+
from fnmatch import fnmatchcase
|
|
10
|
+
from importlib.resources import files
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from flake8.discover_files import expand_paths # type: ignore[import-untyped]
|
|
14
|
+
from flake8.utils import normalize_paths # type: ignore[import-untyped]
|
|
15
|
+
|
|
16
|
+
from max_lint.config import Config, ConfigError
|
|
17
|
+
|
|
18
|
+
STYLE = files("max_lint") / "style"
|
|
19
|
+
BUNDLED_EXCLUDE = (".git", ".venv")
|
|
20
|
+
INIT_CODES = ("D104", "F401")
|
|
21
|
+
FLAKE8_SEPARATORS = re.compile(r"[\s:,]")
|
|
22
|
+
TOOL_ENVIRONMENT = {"DOCUTILSCONFIG": str(STYLE / "docutils.conf"), "PYTHONSAFEPATH": "1"}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _identity(path: str | Path) -> tuple[int, int]:
|
|
26
|
+
"""Return the device and inode of the file or directory ``path`` resolves to."""
|
|
27
|
+
status = os.stat(path)
|
|
28
|
+
|
|
29
|
+
return status.st_dev, status.st_ino
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def python_files(config: Config) -> list[str]:
|
|
33
|
+
"""
|
|
34
|
+
List the Python files under ``paths`` and ``test-paths``, minus the excluded ones.
|
|
35
|
+
|
|
36
|
+
:param config: project settings; exclude patterns follow flake8's ``exclude`` matching.
|
|
37
|
+
:return: paths relative to the current directory, sorted, with each file once under the first spelling found and
|
|
38
|
+
entries that do not resolve to a regular file left out.
|
|
39
|
+
:raises ConfigError: when no Python file is left to lint.
|
|
40
|
+
"""
|
|
41
|
+
found = expand_paths(
|
|
42
|
+
paths=[*config.paths, *config.test_paths],
|
|
43
|
+
stdin_display_name="stdin",
|
|
44
|
+
filename_patterns=["*.py"],
|
|
45
|
+
exclude=normalize_paths([*BUNDLED_EXCLUDE, *config.exclude]),
|
|
46
|
+
)
|
|
47
|
+
spellings: dict[tuple[int, int], str] = {}
|
|
48
|
+
|
|
49
|
+
for path in found:
|
|
50
|
+
with contextlib.suppress(OSError):
|
|
51
|
+
if stat.S_ISREG(os.stat(path).st_mode):
|
|
52
|
+
spellings.setdefault(_identity(path), os.path.relpath(path))
|
|
53
|
+
|
|
54
|
+
result = sorted(spellings.values())
|
|
55
|
+
|
|
56
|
+
if not result:
|
|
57
|
+
raise ConfigError(
|
|
58
|
+
"no Python files found under 'paths' and 'test-paths' in [tool.max-lint]; point them at Python sources.",
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return result
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def per_file_ignores(config: Config, targets: list[str]) -> str:
|
|
65
|
+
"""
|
|
66
|
+
Build a flake8 config whose ``per-file-ignores`` name each target exactly, with all of its ignored codes.
|
|
67
|
+
|
|
68
|
+
:param config: project settings.
|
|
69
|
+
:param targets: paths from ``python_files``.
|
|
70
|
+
:return: the config file text.
|
|
71
|
+
:raises ConfigError: when a target that needs ignored codes has whitespace, ``:``, ``,`` or a non-UTF-8 name.
|
|
72
|
+
"""
|
|
73
|
+
test_roots = {_identity(path) for path in config.test_paths}
|
|
74
|
+
lines = ["[flake8]", "per-file-ignores ="]
|
|
75
|
+
|
|
76
|
+
for target in targets:
|
|
77
|
+
codes = list(INIT_CODES) if os.path.basename(target) == "__init__.py" else []
|
|
78
|
+
|
|
79
|
+
resolved = Path(target).resolve()
|
|
80
|
+
|
|
81
|
+
if any(_identity(location) in test_roots for location in (resolved, *resolved.parents)):
|
|
82
|
+
codes.append("DOC")
|
|
83
|
+
|
|
84
|
+
for glob, entry_codes in config.per_file_ignores.items():
|
|
85
|
+
if fnmatchcase(target, os.path.normpath(glob)):
|
|
86
|
+
codes.extend(entry_codes)
|
|
87
|
+
|
|
88
|
+
if not codes:
|
|
89
|
+
continue
|
|
90
|
+
|
|
91
|
+
if FLAKE8_SEPARATORS.search(target) or target.encode("utf-8", "replace").decode("utf-8") != target:
|
|
92
|
+
raise ConfigError(
|
|
93
|
+
f"{target!r} needs ignored codes from [tool.max-lint] but flake8 cannot name a path with whitespace, ':', ',' "
|
|
94
|
+
"or a name that is not UTF-8; rename it or add it to 'exclude'.",
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
pattern = re.sub(r"([*?[])", r"[\1]", target)
|
|
98
|
+
lines.append(f" ./{pattern}: {', '.join(dict.fromkeys(codes))}")
|
|
99
|
+
|
|
100
|
+
return "\n".join(lines) + "\n"
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def lint_commands(config: Config, check: bool, scratch: Path) -> list[list[str]]:
|
|
104
|
+
"""
|
|
105
|
+
Return the black, isort, flake8 and mypy commands, in the order they run.
|
|
106
|
+
|
|
107
|
+
:param config: project settings.
|
|
108
|
+
:param check: run black and isort in their check modes, which write nothing.
|
|
109
|
+
:param scratch: directory outside the project for the generated flake8 config; it must outlive the commands.
|
|
110
|
+
:return: one argument list per tool, each run with the current interpreter.
|
|
111
|
+
"""
|
|
112
|
+
targets = python_files(config)
|
|
113
|
+
ignores = scratch / "per-file-ignores.ini"
|
|
114
|
+
ignores.write_text(per_file_ignores(config, targets), encoding="utf-8")
|
|
115
|
+
formatters = str(STYLE / "formatters.toml")
|
|
116
|
+
root = Path.cwd()
|
|
117
|
+
black = [sys.executable, "-m", "black", "--config", formatters]
|
|
118
|
+
black += [f"--target-version={version}" for version in config.black_target_versions]
|
|
119
|
+
isort = [sys.executable, "-m", "isort", "--settings-file", formatters, "--src", str(root / "src"), "--src", str(root)]
|
|
120
|
+
|
|
121
|
+
if check:
|
|
122
|
+
black.append("--check")
|
|
123
|
+
isort.append("--check-only")
|
|
124
|
+
|
|
125
|
+
flake8 = [sys.executable, "-m", "flake8", "--config", str(STYLE / "flake8.ini"), "--append-config", str(ignores)]
|
|
126
|
+
|
|
127
|
+
commands = [[*command, "--", *targets] for command in (black, isort, flake8)]
|
|
128
|
+
mypy = [sys.executable, "-m", "mypy", "--config-file", str(root / "pyproject.toml")]
|
|
129
|
+
mypy += ["--python-executable", sys.executable, "--disallow-untyped-defs", "--warn-redundant-casts", "--no-implicit-optional"]
|
|
130
|
+
|
|
131
|
+
return [*commands, [*mypy, "--", *(f"./{path}" for path in python_files(replace(config, test_paths=[])))]]
|
max_lint/py.typed
ADDED
|
File without changes
|
max_lint/pytest_step.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Build and run the pytest command with branch coverage and a coverage floor the project cannot lower."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
from max_lint.config import Config, ConfigError
|
|
10
|
+
from max_lint.lint import STYLE
|
|
11
|
+
|
|
12
|
+
FAIL_UNDER = 95
|
|
13
|
+
REPORT_NAME = "coverage.json"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def pytest_command(config: Config, scratch: Path) -> list[str]:
|
|
17
|
+
"""
|
|
18
|
+
Return the pytest command that measures ``coverage-source`` over ``test-paths``.
|
|
19
|
+
|
|
20
|
+
:param config: project settings.
|
|
21
|
+
:param scratch: directory outside the project for the generated coverage config and report; it must outlive the command.
|
|
22
|
+
:return: an argument list that runs pytest with the current interpreter and the working directory on ``sys.path``.
|
|
23
|
+
:raises ConfigError: when ``test-paths`` or ``coverage-source`` is empty.
|
|
24
|
+
"""
|
|
25
|
+
if not config.test_paths:
|
|
26
|
+
raise ConfigError("'test-paths' in [tool.max-lint] is empty; list the test paths, for example test-paths = [\"tests\"].")
|
|
27
|
+
|
|
28
|
+
if not config.coverage_source:
|
|
29
|
+
raise ConfigError(
|
|
30
|
+
"'coverage-source' in [tool.max-lint] is missing or empty; list the packages or directories to measure, "
|
|
31
|
+
'for example coverage-source = ["src"].',
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
coverage_config = scratch / "coverage.toml"
|
|
35
|
+
text = (STYLE / "coverage.toml").read_text(encoding="utf-8")
|
|
36
|
+
|
|
37
|
+
if config.coverage_omit:
|
|
38
|
+
omit = ", ".join(
|
|
39
|
+
json.dumps(pattern, ensure_ascii=False).replace("\x7f", "\\u007f").replace("$", "$$")
|
|
40
|
+
for pattern in config.coverage_omit
|
|
41
|
+
)
|
|
42
|
+
text += f"\n[run]\nomit = [{omit}]\n"
|
|
43
|
+
|
|
44
|
+
coverage_config.write_text(text, encoding="utf-8")
|
|
45
|
+
|
|
46
|
+
return [
|
|
47
|
+
sys.executable,
|
|
48
|
+
"-m",
|
|
49
|
+
"pytest",
|
|
50
|
+
"--import-mode=importlib",
|
|
51
|
+
"--cov-reset",
|
|
52
|
+
*[f"--cov={source}" for source in config.coverage_source],
|
|
53
|
+
f"--cov-config={coverage_config}",
|
|
54
|
+
"--cov-branch",
|
|
55
|
+
"--cov-report=term-missing",
|
|
56
|
+
f"--cov-report=json:{scratch / REPORT_NAME}",
|
|
57
|
+
f"--cov-fail-under={FAIL_UNDER}",
|
|
58
|
+
"--cov-precision=2",
|
|
59
|
+
*(path if os.path.isabs(path) else f"./{path}" for path in config.test_paths),
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def run_tests(command: list[str], scratch: Path) -> int:
|
|
64
|
+
"""
|
|
65
|
+
Run the pytest command and fail when coverage measured no statements, even if every test passed.
|
|
66
|
+
|
|
67
|
+
:param command: the result of ``pytest_command``.
|
|
68
|
+
:param scratch: the directory ``command`` was built with.
|
|
69
|
+
:return: 0 when pytest passes and measured code, otherwise 1.
|
|
70
|
+
"""
|
|
71
|
+
returncode = subprocess.run(command, check=False).returncode
|
|
72
|
+
|
|
73
|
+
if returncode not in (0, 1):
|
|
74
|
+
return 1
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
statements = json.loads((scratch / REPORT_NAME).read_text(encoding="utf-8"))["totals"]["num_statements"]
|
|
78
|
+
except FileNotFoundError:
|
|
79
|
+
statements = 0
|
|
80
|
+
|
|
81
|
+
if statements == 0:
|
|
82
|
+
print(
|
|
83
|
+
"max-lint: coverage measured no files that contain statements; check 'coverage-source' and 'coverage-omit' in [tool.max-lint].",
|
|
84
|
+
file=sys.stderr,
|
|
85
|
+
)
|
|
86
|
+
return 1
|
|
87
|
+
|
|
88
|
+
return returncode
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[flake8]
|
|
2
|
+
extend-select =
|
|
3
|
+
ANN401
|
|
4
|
+
|
|
5
|
+
extend-ignore =
|
|
6
|
+
E203
|
|
7
|
+
E501
|
|
8
|
+
|
|
9
|
+
style = sphinx
|
|
10
|
+
arg-type-hints-in-docstring = false
|
|
11
|
+
check-return-types = false
|
|
12
|
+
skip-checking-short-docstrings = false
|
|
13
|
+
skip-checking-private-functions = true
|
|
14
|
+
allow-init-docstring = true
|
|
15
|
+
check-class-attributes = false
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: max-lint
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: One command that runs black, isort, flake8, mypy and pytest with a single shared configuration.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ksco92/rattata
|
|
6
|
+
Project-URL: Issues, https://github.com/ksco92/rattata/issues
|
|
7
|
+
Project-URL: Source, https://github.com/ksco92/rattata
|
|
8
|
+
Author: Rodrigo Carvajal
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Keywords: black,coverage,flake8,isort,lint,linter,mypy,pytest
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.13
|
|
24
|
+
Requires-Dist: black==26.10.1
|
|
25
|
+
Requires-Dist: coverage==7.17.3
|
|
26
|
+
Requires-Dist: flake8-annotations==3.3.1
|
|
27
|
+
Requires-Dist: flake8-commas==4.0.0
|
|
28
|
+
Requires-Dist: flake8-docstrings==1.7.0
|
|
29
|
+
Requires-Dist: flake8-multiline-containers==0.0.19
|
|
30
|
+
Requires-Dist: flake8-rst-docstrings==0.4.0
|
|
31
|
+
Requires-Dist: flake8==7.5.0
|
|
32
|
+
Requires-Dist: isort==9.0.2
|
|
33
|
+
Requires-Dist: mypy==2.4.1
|
|
34
|
+
Requires-Dist: pydoclint[flake8]==0.12.0
|
|
35
|
+
Requires-Dist: pytest-cov==7.1.0
|
|
36
|
+
Requires-Dist: pytest-socket==0.8.1
|
|
37
|
+
Requires-Dist: pytest==9.2.0
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# max-lint
|
|
41
|
+
|
|
42
|
+
[](https://github.com/ksco92/rattata/actions/workflows/ci.yml)
|
|
43
|
+
[](https://pypi.org/project/max-lint/)
|
|
44
|
+
|
|
45
|
+
**One command that runs black, isort, flake8, mypy and pytest with a single shared configuration. Every tool is pinned to an exact version.**
|
|
46
|
+
|
|
47
|
+
Status (November 2026): max-lint is published on PyPI. The `lint` command runs black, isort, flake8 and mypy with the bundled style, the `test` command runs pytest with branch coverage and a coverage floor, and a bare `max-lint` runs both.
|
|
48
|
+
|
|
49
|
+
## Contents
|
|
50
|
+
|
|
51
|
+
- [Install](#install)
|
|
52
|
+
- [Usage](#usage)
|
|
53
|
+
- [Configuration](#configuration)
|
|
54
|
+
- [Bundled style](#bundled-style)
|
|
55
|
+
- [Project mypy and pytest settings](#project-mypy-and-pytest-settings)
|
|
56
|
+
- [Commands and exit codes](#commands-and-exit-codes)
|
|
57
|
+
- [Known limitations](#known-limitations)
|
|
58
|
+
- [Contributing](#contributing)
|
|
59
|
+
- [License](#license)
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
Requires Python 3.13 or newer and [uv](https://docs.astral.sh/uv/). Add max-lint to a project as a development dependency, from a directory whose `pyproject.toml` has a `[project]` table with `name` and `version`:
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
uv add --dev max-lint
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
A project declares what it owns in a `[tool.max-lint]` table of its `pyproject.toml`. Run the commands with `uv run` from the directory that holds `pyproject.toml`. This project, with max-lint added as above:
|
|
72
|
+
|
|
73
|
+
```toml
|
|
74
|
+
# pyproject.toml
|
|
75
|
+
[project]
|
|
76
|
+
name = "inventory"
|
|
77
|
+
version = "0.1.0"
|
|
78
|
+
requires-python = ">=3.13"
|
|
79
|
+
|
|
80
|
+
[tool.max-lint]
|
|
81
|
+
paths = ["src"]
|
|
82
|
+
test-paths = ["tests"]
|
|
83
|
+
coverage-source = ["src/inventory"]
|
|
84
|
+
|
|
85
|
+
[tool.pytest.ini_options]
|
|
86
|
+
pythonpath = ["src"]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
# src/inventory/__init__.py
|
|
91
|
+
"""Inventory tracking."""
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
# src/inventory/stock.py
|
|
96
|
+
"""Stock levels per item."""
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def restock(levels: dict[str, int], item: str, count: int) -> dict[str, int]:
|
|
100
|
+
"""
|
|
101
|
+
Return a copy of ``levels`` with ``count`` more of ``item``.
|
|
102
|
+
|
|
103
|
+
:param levels: current stock per item.
|
|
104
|
+
:return: the updated stock.
|
|
105
|
+
"""
|
|
106
|
+
return {**levels, item: levels.get(item, 0)+count}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
# tests/test_stock.py
|
|
111
|
+
"""Tests for stock levels."""
|
|
112
|
+
|
|
113
|
+
from inventory.stock import restock
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def test_restock_adds_to_existing_item() -> None:
|
|
117
|
+
"""Restocking an item adds to its count."""
|
|
118
|
+
assert restock({'apple': 1}, 'apple', 2) == {'apple': 3}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`max-lint lint --check` on the example:
|
|
122
|
+
|
|
123
|
+
```console
|
|
124
|
+
$ uv run max-lint lint --check
|
|
125
|
+
would reformat src/inventory/stock.py
|
|
126
|
+
would reformat tests/test_stock.py
|
|
127
|
+
|
|
128
|
+
Oh no! 💥 💔 💥
|
|
129
|
+
2 files would be reformatted, 1 file would be left unchanged.
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`max-lint lint` rewrites the files with black, then isort, then runs flake8 and mypy:
|
|
133
|
+
|
|
134
|
+
```console
|
|
135
|
+
$ uv run max-lint lint
|
|
136
|
+
reformatted src/inventory/stock.py
|
|
137
|
+
reformatted tests/test_stock.py
|
|
138
|
+
|
|
139
|
+
All done! ✨ 🍰 ✨
|
|
140
|
+
2 files reformatted, 1 file left unchanged.
|
|
141
|
+
src/inventory/stock.py:4:1: DOC101 Function `restock`: Docstring contains fewer arguments than in function signature.
|
|
142
|
+
src/inventory/stock.py:4:1: DOC103 Function `restock`: Docstring arguments are different from function arguments. (Or could be other formatting issues: https://jsh9.github.io/pydoclint/violation_codes.html#notes-on-doc103 ). Arguments in the function signature but not in the docstring: [count: int, item: str].
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Once flake8 passes, mypy runs last. With `src/inventory/__init__.py` and `tests/test_stock.py` as the previous command left them, a completed `restock` docstring in `src/inventory/stock.py`:
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
# src/inventory/stock.py
|
|
149
|
+
"""Stock levels per item."""
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def restock(levels: dict[str, int], item: str, count: int) -> dict[str, int]:
|
|
153
|
+
"""
|
|
154
|
+
Return a copy of ``levels`` with ``count`` more of ``item``.
|
|
155
|
+
|
|
156
|
+
:param levels: current stock per item.
|
|
157
|
+
:param item: the item to restock.
|
|
158
|
+
:param count: how many to add.
|
|
159
|
+
:return: the updated stock.
|
|
160
|
+
"""
|
|
161
|
+
return {**levels, item: levels.get(item, 0) + count}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
and a new module that passes a string where `restock` expects an int:
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
# src/inventory/report.py
|
|
168
|
+
"""Stock report."""
|
|
169
|
+
|
|
170
|
+
from inventory.stock import restock
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def weekly_delivery() -> dict[str, int]:
|
|
174
|
+
"""
|
|
175
|
+
Return the stock after the weekly delivery.
|
|
176
|
+
|
|
177
|
+
:return: the updated stock.
|
|
178
|
+
"""
|
|
179
|
+
return restock({"apple": 1}, "apple", "3")
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
the same command ends in mypy:
|
|
183
|
+
|
|
184
|
+
```console
|
|
185
|
+
$ uv run max-lint lint
|
|
186
|
+
All done! ✨ 🍰 ✨
|
|
187
|
+
4 files left unchanged.
|
|
188
|
+
src/inventory/report.py:12: error: Argument 3 to "restock" has incompatible type "str"; expected "int" [arg-type]
|
|
189
|
+
Found 1 error in 1 file (checked 3 source files)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
`max-lint test` runs pytest over `test-paths` and measures `coverage-source` with branch coverage. Delete `src/inventory/report.py` from the example above, which leaves `stock.py` as completed there, and the tests pass:
|
|
193
|
+
|
|
194
|
+
```console
|
|
195
|
+
$ uv run max-lint test
|
|
196
|
+
============================= test session starts ==============================
|
|
197
|
+
platform <platform> -- Python <python>, pytest-<version>, pluggy-<version>
|
|
198
|
+
rootdir: <project>
|
|
199
|
+
configfile: pyproject.toml
|
|
200
|
+
plugins: platformdirs-<version>, cov-<version>, socket-<version>
|
|
201
|
+
collected 1 item
|
|
202
|
+
|
|
203
|
+
tests/test_stock.py . [100%]
|
|
204
|
+
|
|
205
|
+
================================ tests coverage ================================
|
|
206
|
+
_______________ coverage: platform <platform>, python <python-build> _______________
|
|
207
|
+
|
|
208
|
+
Name Stmts Miss Branch BrPart Cover Missing
|
|
209
|
+
-------------------------------------------------------------------------
|
|
210
|
+
src/inventory/__init__.py 0 0 0 0 100.00%
|
|
211
|
+
src/inventory/stock.py 2 0 0 0 100.00%
|
|
212
|
+
-------------------------------------------------------------------------
|
|
213
|
+
TOTAL 2 0 0 0 100.00%
|
|
214
|
+
Coverage JSON written to file <tmp>/coverage.json
|
|
215
|
+
Required test coverage of 95% reached. Total coverage: 100.00%
|
|
216
|
+
============================== 1 passed in <seconds>s ===============================
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
The output shows `<project>` for the project directory, `<tmp>` for a temporary directory, `<platform>` for the operating system, `<python>` for the Python version, `<python-build>` for the Python version with its release level, `<version>` for the version of the package named before it, and `<seconds>` for the run time. Coverage writes its data file, `.coverage`, to the project directory.
|
|
220
|
+
|
|
221
|
+
A bare `max-lint` on the example project as it was for the passing test run prints the lint tools' results first, followed by the pytest output shown above:
|
|
222
|
+
|
|
223
|
+
```console
|
|
224
|
+
$ uv run max-lint
|
|
225
|
+
All done! ✨ 🍰 ✨
|
|
226
|
+
3 files left unchanged.
|
|
227
|
+
Success: no issues found in 2 source files
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Configuration
|
|
231
|
+
|
|
232
|
+
The `[tool.max-lint]` table takes these keys and no others:
|
|
233
|
+
|
|
234
|
+
| Key | Type | Required | Meaning |
|
|
235
|
+
| --- | --- | --- | --- |
|
|
236
|
+
| `paths` | list of strings | yes | Source paths to format, lint and type-check. |
|
|
237
|
+
| `test-paths` | list of strings | no | Test paths: exempt from the pydoclint `DOC` codes and run by pytest, so the test step needs at least one. |
|
|
238
|
+
| `coverage-source` | list of strings | no | Packages or directories to measure, as pytest-cov's `--cov` takes them; the test step needs at least one. |
|
|
239
|
+
| `coverage-omit` | list of strings | no | Glob patterns of files to leave out of the measurement; one not starting with `*` is relative to `pyproject.toml`. |
|
|
240
|
+
| `exclude` | list of strings | no | Extra flake8-style exclude patterns such as `"src/inventory/generated"`, removed from black, isort and flake8 alike. |
|
|
241
|
+
| `per-file-ignores` | table of glob to list of strings | no | Flake8 codes to ignore per file, such as `{ "src/inventory/legacy.py" = ["D103"] }`; a glob matches a file's path relative to `pyproject.toml`, and `*` also matches `/`. |
|
|
242
|
+
|
|
243
|
+
Every path in `paths` and `test-paths` must exist; paths are relative to `pyproject.toml` and may point outside its directory. Ignored codes add up per file: the `DOC` exemption of test paths, `D104` and `F401` for every `__init__.py`, and the codes of every `per-file-ignores` entry whose glob matches.
|
|
244
|
+
|
|
245
|
+
## Bundled style
|
|
246
|
+
|
|
247
|
+
The tools are black, isort, flake8, mypy, pytest, pytest-cov, pytest-socket and coverage, each pinned to an exact version in [pyproject.toml](https://github.com/ksco92/rattata/blob/main/pyproject.toml). The flake8 plugins are flake8-annotations, flake8-docstrings, flake8-rst-docstrings, flake8-commas, flake8-multiline-containers and pydoclint.
|
|
248
|
+
|
|
249
|
+
- black and isort use line length 130, and isort uses `profile = "black"`. black targets the Python versions allowed by `requires-python`.
|
|
250
|
+
- flake8 selects `ANN401` in addition to its defaults and ignores `E203` and `E501`. pydoclint checks Sphinx-style docstrings without argument types in the docstring and skips private functions and return types.
|
|
251
|
+
- Docstrings are parsed with the `raw` and `include` directives disabled, so flake8 reports each use as `RST299`.
|
|
252
|
+
- mypy always runs with `disallow_untyped_defs`, `warn_redundant_casts` and `no_implicit_optional`.
|
|
253
|
+
- Coverage is branch coverage with a floor of 95% compared to two decimals, the missing lines shown, and `pragma: no cover` and `if __name__ == .__main__.:` as the excluded lines.
|
|
254
|
+
- pytest runs with `--import-mode=importlib`, and the current directory is importable, so a project that is not an installed package can import its own modules in its tests.
|
|
255
|
+
|
|
256
|
+
Settings for these tools in the project (`[tool.black]`, `[tool.isort]`, `.flake8`, `setup.cfg`, `tox.ini`, `.isort.cfg`, `[tool.coverage.*]`, `.coveragerc` and `.coveragerc.toml`) have no effect.
|
|
257
|
+
|
|
258
|
+
## Project mypy and pytest settings
|
|
259
|
+
|
|
260
|
+
mypy checks the files under `paths` only, so test code is not type-checked unless a `paths` entry also covers it. Apart from the three locked settings, it reads the `[tool.mypy]` table and the `[[tool.mypy.overrides]]` entries of the project's `pyproject.toml`, such as `python_version`, `plugins` and per-module `ignore_missing_imports`; a project with no `[tool.mypy]` table works, and no other mypy configuration file (`mypy.ini`, `setup.cfg`) is read:
|
|
261
|
+
|
|
262
|
+
```toml
|
|
263
|
+
[tool.mypy]
|
|
264
|
+
python_version = "3.13"
|
|
265
|
+
|
|
266
|
+
[[tool.mypy.overrides]]
|
|
267
|
+
module = ["legacy_sdk.*"]
|
|
268
|
+
ignore_missing_imports = true
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
A project that sets one of the three locked settings in `[tool.mypy]` or in an override, under any name mypy accepts for it (`allow_untyped_defs`, for example), gets exit status 2 before any tool runs. mypy resolves third-party imports from the environment max-lint runs in, and writes its cache to `.mypy_cache` in the current directory. A plugin named by module must be importable from that environment because the working directory is not on the import path; a plugin given as a file path works. The project's `[tool.pytest.ini_options]` is read, so keys such as `pythonpath` work.
|
|
272
|
+
|
|
273
|
+
## Commands and exit codes
|
|
274
|
+
|
|
275
|
+
- `max-lint` runs the lint steps, then the test step; `max-lint --check` does the same with black and isort in their check modes.
|
|
276
|
+
- `max-lint lint` formats with black and isort, then runs flake8 and mypy; `max-lint lint --check` rewrites no files.
|
|
277
|
+
- `max-lint test` runs pytest with coverage.
|
|
278
|
+
- `max-lint --help` prints the available commands and `max-lint --version` the installed version.
|
|
279
|
+
|
|
280
|
+
Every command stops at the first step that fails. The exit status is 0 when every step passes and 1 when a tool reports a failure. The test step also exits 1 when coverage measures no file that contains a statement, even if every test passed. With `coverage-omit = ["src/inventory/stock.py"]` added to the example's `[tool.max-lint]`, the only file left in the measurement is the docstring-only `__init__.py`. The output is the same as in the passing run except that the `stock.py` row is gone, `TOTAL` counts no statements, and the last line is added:
|
|
281
|
+
|
|
282
|
+
```console
|
|
283
|
+
$ uv run max-lint test
|
|
284
|
+
src/inventory/__init__.py 0 0 0 0 100.00%
|
|
285
|
+
TOTAL 0 0 0 0 100.00%
|
|
286
|
+
max-lint: coverage measured no files that contain statements; check 'coverage-source' and 'coverage-omit' in [tool.max-lint].
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Exit status 2 and a one-line message on stderr mean a configuration error in `pyproject.toml` or its `[tool.max-lint]` table. The message says what to fix. A bare `max-lint` reports a configuration error of the test step before it rewrites any file. A usage error, such as an unknown command or option, also exits 2.
|
|
290
|
+
|
|
291
|
+
## Known limitations
|
|
292
|
+
|
|
293
|
+
- `max-lint test` and a bare `max-lint` run the project's tests, so the project's code, its `conftest.py` files and its pytest configuration execute. Coverage can be changed from inside that code, for example through the coverage API in a `conftest.py`.
|
|
294
|
+
- A project's `[tool.mypy]` table is trusted configuration. Plugins named there are loaded and run, and other settings there can make mypy write and read files outside the project and expand environment variables, so `max-lint lint` is not a read-only operation on a repository that has that table.
|
|
295
|
+
- A `coverage-source` entry that matches nothing only prints a coverage warning and does not fail the run while another entry measures code.
|
|
296
|
+
- Two `paths` entries that each hold a module of the same name without an `__init__.py` make mypy report a duplicate module and the lint run fail.
|
|
297
|
+
- A file named like a library module that mypy uses, such as `typing_extensions.py` in the project root, makes the mypy step fail.
|
|
298
|
+
- `max-lint --check test` accepts `--check` without effect: the tests run and no formatting is checked.
|
|
299
|
+
|
|
300
|
+
## Contributing
|
|
301
|
+
|
|
302
|
+
Setup, the checks a change must pass and the rules for the bundled style are in [CONTRIBUTING.md](https://github.com/ksco92/rattata/blob/main/CONTRIBUTING.md).
|
|
303
|
+
max-lint is maintained by Rodrigo Carvajal; bugs and proposals go in [GitHub issues](https://github.com/ksco92/rattata/issues).
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
Apache-2.0. See [LICENSE](https://github.com/ksco92/rattata/blob/main/LICENSE) and [NOTICE](https://github.com/ksco92/rattata/blob/main/NOTICE).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
max_lint/__init__.py,sha256=zEqFSOh2DZcryhp5GnhRYGu5w4UVmE8Q9jz70TshbS0,34
|
|
2
|
+
max_lint/cli.py,sha256=YWClmEm2KIb6fiy9dWwjnrVYunOZkULi78JuyT93d4s,2654
|
|
3
|
+
max_lint/config.py,sha256=7KhFzmJZS-QxGbmMStTghTS0TbyRzMgGf-wP3eYv3fw,5981
|
|
4
|
+
max_lint/lint.py,sha256=Ow3pWAWEh4csdsCS4-MSVbvE8Z0088kEVg-xiAwTSVk,5298
|
|
5
|
+
max_lint/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
6
|
+
max_lint/pytest_step.py,sha256=4mB7lUM15s3-wN4yOhtvDpL1jq-2uSsrl9ZHEtaeh-o,3100
|
|
7
|
+
max_lint/style/coverage.toml,sha256=JK-VkSOdhZTiUPQMSwTOvHGDmO0z2YZjxcMfuHvYvtg,76
|
|
8
|
+
max_lint/style/docutils.conf,sha256=HCl73MfBowSrmFOn2fOGREnq8clarG8ezei_7h0tyI0,59
|
|
9
|
+
max_lint/style/flake8.ini,sha256=ECX6nDV41_bDXZQmCBHYGy9fZ6qmoZMYyMldiYjRVQU,287
|
|
10
|
+
max_lint/style/formatters.toml,sha256=2hm96dixJiobvg8HFXHxVZZUVWGntdmoT7lH7kVEH3o,81
|
|
11
|
+
max_lint-0.6.0.dist-info/METADATA,sha256=2tAQBYshDQwHZ_GMpqJ7FlSv_nZboQXfeH2cqKrS8NA,15402
|
|
12
|
+
max_lint-0.6.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
13
|
+
max_lint-0.6.0.dist-info/entry_points.txt,sha256=Nn67a6YyUCzGMEETxVr2tWYEsm0_AMSnXTUti3sFERo,47
|
|
14
|
+
max_lint-0.6.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
15
|
+
max_lint-0.6.0.dist-info/licenses/NOTICE,sha256=1YKY45KMkP-JPKr9_PRspaF6X3V6LyLPo9JerMaLshA,41
|
|
16
|
+
max_lint-0.6.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|