Skip to content

Commit

Permalink
Merge pull request #6 from pylint-dev/pre-commit-ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
stdedos authored Oct 14, 2023
2 parents 5ee69ce + ae436ac commit a1fc41e
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 55 deletions.
44 changes: 6 additions & 38 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,12 @@ repos:
- id: pretty-format-json
args: [ "--no-sort-keys", "--autofix", "--indent=4" ]
exclude: ^.vscode/
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.292
hooks:
- id: pyupgrade
args:
- --py36-plus
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
hooks:
- id: autoflake
# - repo: https://github.com/astral-sh/ruff-pre-commit
# rev: v0.0.292
# hooks:
# - id: ruff
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args:
- --filter-files
- id: ruff
args: ["--fix"]
exclude: "tests/input/"
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
Expand All @@ -37,7 +23,7 @@ repos:
hooks:
- id: blacken-docs
additional_dependencies:
- black==22.6.0
- black==23.9.1
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
Expand All @@ -52,24 +38,6 @@ repos:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
# - repo: https://github.com/pycqa/flake8
# rev: 5.0.4
# hooks:
# - id: flake8
# additional_dependencies:
# - flake8-bandit
# - flake8-bugbear
# - flake8-class-attributes-order
# - flake8-comprehensions
# # - flake8-docstrings # it is a mess to clean up; let's only warn user's IDEs instead.
# - flake8-future-annotations
# - flake8-noqa
# - flake8-print
# - flake8-pyproject
# - flake8-pytest-style
# - flake8-type-checking
# - flake8-variables-names
# - pep8-naming
# - repo: https://github.com/pre-commit/mirrors-mypy
# rev: v1.6.0
# hooks:
Expand Down
2 changes: 1 addition & 1 deletion pylint_pytest/checkers/class_attr_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ def visit_assignattr(self, node):

# hack class locals
self.class_node.locals[node.attrname] = [assign_node.value]
except: # pylint: disable=bare-except
except Exception: # pylint: disable=broad-except
# cannot find valid assign expr, skipping the entire attribute
pass
3 changes: 2 additions & 1 deletion pylint_pytest/checkers/fixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class FixtureChecker(BasePytestChecker):
"F6401": (
(
"pylint-pytest plugin cannot enumerate and collect pytest fixtures. "
"Please run `pytest --fixtures --collect-only path/to/current/module.py` and resolve any potential syntax error or package dependency issues"
"Please run `pytest --fixtures --collect-only path/to/current/module.py`"
" and resolve any potential syntax error or package dependency issues"
),
"cannot-enumerate-pytest-fixtures",
"Used when pylint-pytest has been unable to enumerate and collect pytest fixtures.",
Expand Down
2 changes: 1 addition & 1 deletion pylint_pytest/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ def _is_same_module(fixtures, import_node, fixture_name):
).file
):
return True
except: # pylint: disable=bare-except
except Exception: # pylint: disable=broad-except
pass
return False
14 changes: 1 addition & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
[tool.black]
line-length = 100

[tool.isort]
profile = "black"

[tool.coverage]
run.branch = true
run.data_file = "test_artifacts/.coverage"
Expand Down Expand Up @@ -38,15 +35,6 @@ paths.source = [
"pylint_pytest/",
]

[tool.flake8]
# Black compatible settings
max-line-length = 100
extend-ignore = ["E203"]
extend-select = ["TC", "TC1", "B902", "B903"]

noqa-require-code = true
noqa-include-name = true

[tool.mypy]
python_version = "3.7"
check_untyped_defs = true
Expand Down Expand Up @@ -93,7 +81,7 @@ select = [
"W", # pycodestyle
"B", # bugbear
"I", # isort
"RUF", # ruff
# "RUF", # ruff
"UP", # pyupgrade
]

Expand Down
1 change: 0 additions & 1 deletion tests/test_cannot_enumerate_fixtures.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import pytest
from base_tester import BasePytestTester
from pylint.checkers.variables import VariablesChecker

from pylint_pytest.checkers.fixture import FixtureChecker

Expand Down

0 comments on commit a1fc41e

Please sign in to comment.