Skip to content

Commit 8afec9a

Browse files
authored
Add autoflake to pre-commit configuration (#9666)
1 parent b79eff0 commit 8afec9a

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ repos:
2020
- id: debug-statements
2121
exclude: _pytest/(debugging|hookspec).py
2222
language_version: python3
23+
- repo: https://github.com/myint/autoflake
24+
rev: v1.4
25+
hooks:
26+
- id: autoflake
27+
name: autoflake
28+
args: ["--in-place", "--remove-unused-variables", "--remove-all-unused-imports"]
29+
language: python
30+
files: \.py$
2331
- repo: https://github.com/PyCQA/flake8
2432
rev: 4.0.1
2533
hooks:

src/_pytest/python.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,8 +905,6 @@ class InstanceDummy:
905905
only to ignore it; this dummy class keeps them working. This will be removed
906906
in pytest 8."""
907907

908-
pass
909-
910908

911909
def __getattr__(name: str) -> object:
912910
if name == "Instance":

src/_pytest/python_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ def _check_type(self) -> None:
131131
# a numeric type. For this reason, the default is to do nothing. The
132132
# classes that deal with sequences should reimplement this method to
133133
# raise if there are any non-numeric elements in the sequence.
134-
pass
135134

136135

137136
def _recursive_list_map(f, x):

testing/code/test_source.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
# flake8: noqa
22
# disable flake check on this file because some constructs are strange
33
# or redundant on purpose and can't be disable on a line-by-line basis
4-
import ast
54
import inspect
65
import linecache
76
import sys
87
import textwrap
98
from pathlib import Path
10-
from types import CodeType
119
from typing import Any
1210
from typing import Dict
13-
from typing import Optional
1411

1512
import pytest
1613
from _pytest._code import Code

0 commit comments

Comments
 (0)