Skip to content

Commit 5fab0d1

Browse files
committed
Update hooks and use autopep8 + add-trailing-comma instead of black
1 parent 23d2a85 commit 5fab0d1

33 files changed

+110
-102
lines changed

.pre-commit-config.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
repos:
2+
- repo: https://github.com/asottile/add-trailing-comma
3+
rev: v3.2.0
4+
hooks:
5+
- id: add-trailing-comma
26
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v4.5.0
7+
rev: v5.0.0
48
hooks:
59
- id: check-yaml
610
- id: debug-statements
711
- id: end-of-file-fixer
812
- id: trailing-whitespace
913
exclude: ^tests/fixtures/
1014
- repo: https://github.com/asottile/setup-cfg-fmt
11-
rev: v2.5.0
15+
rev: v2.8.0
1216
hooks:
1317
- id: setup-cfg-fmt
1418
- repo: https://github.com/asottile/reorder-python-imports
15-
rev: v3.14.0
19+
rev: v3.15.0
1620
hooks:
1721
- id: reorder-python-imports
1822
args: [
@@ -21,21 +25,20 @@ repos:
2125
--add-import, 'from __future__ import annotations',
2226
]
2327
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.19.1
28+
rev: v3.20.0
2529
hooks:
2630
- id: pyupgrade
2731
args: [--py39-plus]
28-
- repo: https://github.com/psf/black
29-
rev: 23.12.1
32+
- repo: https://github.com/hhatto/autopep8
33+
rev: v2.3.2
3034
hooks:
31-
- id: black
32-
args: [--line-length=79]
35+
- id: autopep8
3336
- repo: https://github.com/PyCQA/flake8
34-
rev: 7.0.0
37+
rev: 7.3.0
3538
hooks:
3639
- id: flake8
3740
- repo: https://github.com/pre-commit/mirrors-mypy
38-
rev: v1.15.0
41+
rev: v1.17.0
3942
hooks:
4043
- id: mypy
4144
exclude: ^(docs/|example-plugin/)

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ classifiers =
1616
Environment :: Console
1717
Framework :: Flake8
1818
Intended Audience :: Developers
19-
License :: OSI Approved :: MIT License
2019
Programming Language :: Python
2120
Programming Language :: Python :: 3
2221
Programming Language :: Python :: 3 :: Only

src/flake8/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,5 @@ def configure_logging(
6666
LOG.addHandler(handler)
6767
LOG.setLevel(log_level)
6868
LOG.debug(
69-
"Added a %s logging handler to logger root at %s", filename, __name__
69+
"Added a %s logging handler to logger root at %s", filename, __name__,
7070
)

src/flake8/api/legacy.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def excluded(path: str) -> bool:
135135
stdin_display_name=self.options.stdin_display_name,
136136
filename_patterns=self.options.filename,
137137
exclude=self.options.exclude,
138-
)
138+
),
139139
)
140140
return not paths
141141

@@ -153,7 +153,7 @@ def init_report(
153153
if not issubclass(reporter, formatter.BaseFormatter):
154154
raise ValueError(
155155
"Report should be subclass of "
156-
"flake8.formatter.BaseFormatter."
156+
"flake8.formatter.BaseFormatter.",
157157
)
158158
self._application.formatter = reporter(self.options)
159159
self._application.guide = None

src/flake8/checker.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
@contextlib.contextmanager
5252
def _mp_prefork(
53-
plugins: Checkers, options: argparse.Namespace
53+
plugins: Checkers, options: argparse.Namespace,
5454
) -> Generator[None]:
5555
# we can save significant startup work w/ `fork` multiprocessing
5656
global _mp
@@ -77,7 +77,7 @@ def _mp_run(filename: str) -> tuple[str, Results, dict[str, int]]:
7777
assert _mp is not None, _mp
7878
plugins, options = _mp
7979
return FileChecker(
80-
filename=filename, plugins=plugins, options=options
80+
filename=filename, plugins=plugins, options=options,
8181
).run_checks()
8282

8383

@@ -137,7 +137,7 @@ def _job_count(self) -> int:
137137
if utils.is_using_stdin(self.options.filenames):
138138
LOG.warning(
139139
"The --jobs option is not compatible with supplying "
140-
"input using - . Ignoring --jobs arguments."
140+
"input using - . Ignoring --jobs arguments.",
141141
)
142142
return 0
143143

@@ -252,7 +252,7 @@ def start(self) -> None:
252252
stdin_display_name=self.options.stdin_display_name,
253253
filename_patterns=self.options.filename,
254254
exclude=self.exclude,
255-
)
255+
),
256256
)
257257
self.jobs = min(len(self.filenames), self.jobs)
258258

@@ -332,11 +332,11 @@ def run_check(self, plugin: LoadedPlugin, **arguments: Any) -> Any:
332332
assert self.processor is not None, self.filename
333333
try:
334334
params = self.processor.keyword_arguments_for(
335-
plugin.parameters, arguments
335+
plugin.parameters, arguments,
336336
)
337337
except AttributeError as ae:
338338
raise exceptions.PluginRequestedUnknownParameters(
339-
plugin_name=plugin.display_name, exception=ae
339+
plugin_name=plugin.display_name, exception=ae,
340340
)
341341
try:
342342
return plugin.obj(**arguments, **params)
@@ -548,7 +548,7 @@ def handle_newline(self, token_type: int) -> None:
548548
self.run_logical_checks()
549549

550550
def check_physical_eol(
551-
self, token: tokenize.TokenInfo, prev_physical: str
551+
self, token: tokenize.TokenInfo, prev_physical: str,
552552
) -> None:
553553
"""Run physical checks if and only if it is at the end of the line."""
554554
assert self.processor is not None
@@ -598,7 +598,7 @@ def _try_initialize_processpool(
598598

599599

600600
def find_offset(
601-
offset: int, mapping: processor._LogicalMapping
601+
offset: int, mapping: processor._LogicalMapping,
602602
) -> tuple[int, int]:
603603
"""Find the offset tuple for a single offset."""
604604
if isinstance(offset, tuple):

src/flake8/formatting/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def format(self, error: Violation) -> str | None:
110110
The formatted error string.
111111
"""
112112
raise NotImplementedError(
113-
"Subclass of BaseFormatter did not implement" " format."
113+
"Subclass of BaseFormatter did not implement" " format.",
114114
)
115115

116116
def show_statistics(self, statistics: Statistics) -> None:

src/flake8/main/application.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def make_guide(self) -> None:
7676
assert self.formatter is not None
7777
assert self.options is not None
7878
self.guide = style_guide.StyleGuideManager(
79-
self.options, self.formatter
79+
self.options, self.formatter,
8080
)
8181

8282
def make_file_checker_manager(self, argv: Sequence[str]) -> None:

src/flake8/main/debug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def information(version: str, plugins: Plugins) -> dict[str, Any]:
1414
(loaded.plugin.package, loaded.plugin.version)
1515
for loaded in plugins.all_plugins()
1616
if loaded.plugin.package not in {"flake8", "local"}
17-
}
17+
},
1818
)
1919
return {
2020
"version": version,

src/flake8/main/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def stage1_arg_parser() -> argparse.ArgumentParser:
3232
)
3333

3434
parser.add_argument(
35-
"--output-file", default=None, help="Redirect report to a file."
35+
"--output-file", default=None, help="Redirect report to a file.",
3636
)
3737

3838
# Config file options

src/flake8/options/config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def load_config(
7878
if config is not None:
7979
if not cfg.read(config, encoding="UTF-8"):
8080
raise exceptions.ExecutionError(
81-
f"The specified config file does not exist: {config}"
81+
f"The specified config file does not exist: {config}",
8282
)
8383
cfg_dir = os.path.dirname(config)
8484
else:
@@ -89,7 +89,7 @@ def load_config(
8989
for filename in extra:
9090
if not cfg.read(filename, encoding="UTF-8"):
9191
raise exceptions.ExecutionError(
92-
f"The specified config file does not exist: {filename}"
92+
f"The specified config file does not exist: {filename}",
9393
)
9494

9595
return cfg, cfg_dir
@@ -131,7 +131,7 @@ def parse_config(
131131
raise ValueError(
132132
f"Error code {error_code!r} "
133133
f"supplied to {option_name!r} option "
134-
f"does not match {VALID_CODE_PREFIX.pattern!r}"
134+
f"does not match {VALID_CODE_PREFIX.pattern!r}",
135135
)
136136

137137
assert option.config_name is not None

0 commit comments

Comments
 (0)