Skip to content

Commit

Permalink
Bump various test dependencies (#349)
Browse files Browse the repository at this point in the history
Enable some new lints from flake8-bugbear and mypy
  • Loading branch information
AlexWaygood authored Feb 19, 2023
1 parent 66f28a4 commit 7dd4398
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
8 changes: 3 additions & 5 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,16 @@
# E704 multiple statements on one line (def) -- disallows function body on the same line as the def
#
# flake8-bugbear rules that cause too many false positives:
# B028 "Use !r inside f-strings instead of manual quotes" --
# produces false positives if you're surrounding things with double quotes
# B905 "`zip()` without an explicit `strict=True` parameter --
# the `strict` parameter was introduced in Python 3.10; we support Python 3.7
# B906 "`visit_` function with no further calls to a visit function" --
# there's no reason to call generic_visit(node) inside visit_Name, visit_Str, etc.
# B907 "Use !r inside f-strings instead of manual quotes" --
# produces false positives if you're surrounding things with double quotes

[flake8]
max-line-length = 80
max-complexity = 12
noqa-require-code = true
select = B,C,E,F,W,Y,B9,NQA
per-file-ignores =
*.py: B028, B905, B906, B950, E203, E501, W503, W291, W293
*.py: B905, B907, B950, E203, E501, W503, W291, W293
*.pyi: B, E301, E302, E305, E501, E701, E704, W503
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
- id: check-merge-conflict
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 22.12.0 # must match pyproject.toml
rev: 23.1.0 # must match pyproject.toml
hooks:
- id: black
language_version: python3.7
Expand Down
5 changes: 3 additions & 2 deletions pyi.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,15 +999,15 @@ def visit_Assign(self, node: ast.Assign) -> None:
self.generic_visit(node)
return
if len(node.targets) == 1:
target = node.targets[0]
target: ast.expr | None = node.targets[0]
if isinstance(target, ast.Name):
target_name = target.id
else:
self.error(node, Y017)
target_name = None
else:
self.error(node, Y017)
target_name = None
target = target_name = None
is_special_assignment = _is_assignment_which_must_have_a_value(
target_name, in_class=self.in_class.active
)
Expand Down Expand Up @@ -1085,6 +1085,7 @@ def _check_for_type_aliases(
self.error(node, Y026.format(suggestion=unparse(new_node)))

def visit_Name(self, node: ast.Name) -> None:
self.generic_visit(node)
self.all_name_occurrences[node.id] += 1

def visit_Call(self, node: ast.Call) -> None:
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ dependencies = [

[project.optional-dependencies]
dev = [
"black==22.12.0", # Must match .pre-commit-config.yaml
"flake8-bugbear==23.1.14",
"black==23.1.0", # Must match .pre-commit-config.yaml
"flake8-bugbear==23.2.13",
"flake8-noqa==1.3.0",
"isort==5.12.0; python_version >= '3.8'", # Must match .pre-commit-config.yaml
"mypy==1.0",
"mypy==1.0.1",
"pre-commit-hooks==4.4.0", # Must match .pre-commit-config.yaml
"pytest==7.2.1",
"types-pyflakes<4",
Expand Down Expand Up @@ -92,7 +92,7 @@ files = ["pyi.py", "tests/test_pyi_files.py"]
show_traceback = true
pretty = true
strict = true
enable_error_code = "ignore-without-code,redundant-expr"
enable_error_code = "ignore-without-code,redundant-expr,possibly-undefined"
warn_unreachable = true
allow_subclassing_any = true
allow_untyped_defs = true
Expand Down

0 comments on commit 7dd4398

Please sign in to comment.