Skip to content

Commit a1fc41e

Browse files
authored
Merge pull request #6 from pylint-dev/pre-commit-ruff
2 parents 5ee69ce + ae436ac commit a1fc41e

File tree

6 files changed

+11
-55
lines changed

6 files changed

+11
-55
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,12 @@ repos:
88
- id: pretty-format-json
99
args: [ "--no-sort-keys", "--autofix", "--indent=4" ]
1010
exclude: ^.vscode/
11-
- repo: https://github.com/asottile/pyupgrade
12-
rev: v3.15.0
11+
- repo: https://github.com/astral-sh/ruff-pre-commit
12+
rev: v0.0.292
1313
hooks:
14-
- id: pyupgrade
15-
args:
16-
- --py36-plus
17-
- repo: https://github.com/PyCQA/autoflake
18-
rev: v2.2.1
19-
hooks:
20-
- id: autoflake
21-
# - repo: https://github.com/astral-sh/ruff-pre-commit
22-
# rev: v0.0.292
23-
# hooks:
24-
# - id: ruff
25-
- repo: https://github.com/pycqa/isort
26-
rev: 5.12.0
27-
hooks:
28-
- id: isort
29-
args:
30-
- --filter-files
14+
- id: ruff
15+
args: ["--fix"]
16+
exclude: "tests/input/"
3117
- repo: https://github.com/psf/black
3218
rev: 23.9.1
3319
hooks:
@@ -37,7 +23,7 @@ repos:
3723
hooks:
3824
- id: blacken-docs
3925
additional_dependencies:
40-
- black==22.6.0
26+
- black==23.9.1
4127
- repo: https://github.com/pre-commit/pygrep-hooks
4228
rev: v1.10.0
4329
hooks:
@@ -52,24 +38,6 @@ repos:
5238
- id: rst-directive-colons
5339
- id: rst-inline-touching-normal
5440
- id: text-unicode-replacement-char
55-
# - repo: https://github.com/pycqa/flake8
56-
# rev: 5.0.4
57-
# hooks:
58-
# - id: flake8
59-
# additional_dependencies:
60-
# - flake8-bandit
61-
# - flake8-bugbear
62-
# - flake8-class-attributes-order
63-
# - flake8-comprehensions
64-
# # - flake8-docstrings # it is a mess to clean up; let's only warn user's IDEs instead.
65-
# - flake8-future-annotations
66-
# - flake8-noqa
67-
# - flake8-print
68-
# - flake8-pyproject
69-
# - flake8-pytest-style
70-
# - flake8-type-checking
71-
# - flake8-variables-names
72-
# - pep8-naming
7341
# - repo: https://github.com/pre-commit/mirrors-mypy
7442
# rev: v1.6.0
7543
# hooks:

pylint_pytest/checkers/class_attr_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ def visit_assignattr(self, node):
4949

5050
# hack class locals
5151
self.class_node.locals[node.attrname] = [assign_node.value]
52-
except: # pylint: disable=bare-except
52+
except Exception: # pylint: disable=broad-except
5353
# cannot find valid assign expr, skipping the entire attribute
5454
pass

pylint_pytest/checkers/fixture.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ class FixtureChecker(BasePytestChecker):
6262
"F6401": (
6363
(
6464
"pylint-pytest plugin cannot enumerate and collect pytest fixtures. "
65-
"Please run `pytest --fixtures --collect-only path/to/current/module.py` and resolve any potential syntax error or package dependency issues"
65+
"Please run `pytest --fixtures --collect-only path/to/current/module.py`"
66+
" and resolve any potential syntax error or package dependency issues"
6667
),
6768
"cannot-enumerate-pytest-fixtures",
6869
"Used when pylint-pytest has been unable to enumerate and collect pytest fixtures.",

pylint_pytest/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ def _is_same_module(fixtures, import_node, fixture_name):
115115
).file
116116
):
117117
return True
118-
except: # pylint: disable=bare-except
118+
except Exception: # pylint: disable=broad-except
119119
pass
120120
return False

pyproject.toml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
[tool.black]
44
line-length = 100
55

6-
[tool.isort]
7-
profile = "black"
8-
96
[tool.coverage]
107
run.branch = true
118
run.data_file = "test_artifacts/.coverage"
@@ -38,15 +35,6 @@ paths.source = [
3835
"pylint_pytest/",
3936
]
4037

41-
[tool.flake8]
42-
# Black compatible settings
43-
max-line-length = 100
44-
extend-ignore = ["E203"]
45-
extend-select = ["TC", "TC1", "B902", "B903"]
46-
47-
noqa-require-code = true
48-
noqa-include-name = true
49-
5038
[tool.mypy]
5139
python_version = "3.7"
5240
check_untyped_defs = true
@@ -93,7 +81,7 @@ select = [
9381
"W", # pycodestyle
9482
"B", # bugbear
9583
"I", # isort
96-
"RUF", # ruff
84+
# "RUF", # ruff
9785
"UP", # pyupgrade
9886
]
9987

tests/test_cannot_enumerate_fixtures.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import pytest
22
from base_tester import BasePytestTester
3-
from pylint.checkers.variables import VariablesChecker
43

54
from pylint_pytest.checkers.fixture import FixtureChecker
65

0 commit comments

Comments
 (0)