Skip to content

Commit 28d2eee

Browse files
authored
🔀 Merge pull request #86 from davep/tighten-linting
Tighten linting rules
2 parents c461423 + 8610bcb commit 28d2eee

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build := uv build
77
publish := uv publish --username=__token__ --keyring-provider=subprocess
88
python := $(run) python
99
ruff := $(run) ruff
10-
lint := $(ruff) check --select I
10+
lint := $(ruff) check
1111
fmt := $(ruff) format
1212
mypy := $(run) mypy
1313
mkdocs := $(run) mkdocs

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,26 @@ explicit = true
7070
venvPath="."
7171
venv=".venv"
7272
exclude=[".venv"]
73+
74+
[tool.ruff.lint]
75+
select = [
76+
# pycodestyle
77+
"E",
78+
# Pyflakes
79+
"F",
80+
# pyupgrade
81+
"UP",
82+
# flake8-bugbear
83+
"B",
84+
# flake8-simplify
85+
"SIM",
86+
# isort
87+
"I",
88+
]
89+
ignore = [
90+
# I think try...expect...pass reads far better.
91+
"SIM105",
92+
]
93+
94+
[tool.ruff.lint.pycodestyle]
95+
max-line-length = 120

src/textual_fspicker/parts/directory_navigation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66

77
##############################################################################
88
# Python imports.
9+
from collections.abc import Iterable
910
from dataclasses import dataclass
1011
from datetime import datetime
1112
from pathlib import Path
12-
from typing import ClassVar, Iterable, NamedTuple, Optional
13+
from typing import ClassVar, Final, NamedTuple, Optional
1314

1415
##############################################################################
1516
# Rich imports.
@@ -26,7 +27,6 @@
2627
from textual.widgets import OptionList
2728
from textual.widgets.option_list import Option
2829
from textual.worker import get_current_worker
29-
from typing_extensions import Final
3030

3131
##############################################################################
3232
# Local imports.
@@ -348,9 +348,12 @@ def hide(self, path: Path) -> bool:
348348
`True` if the path should be hidden, `False` if not.
349349
"""
350350
# If there's a custom filter in place, give that a go first...
351-
if self.file_filter is not None and is_file(path):
352-
if not self.file_filter(path):
353-
return True
351+
if (
352+
self.file_filter is not None
353+
and is_file(path)
354+
and not self.file_filter(path)
355+
):
356+
return True
354357
# Either there is no custom filter, or whatever we're looking at
355358
# passed so far; not do final checks.
356359
return self.is_hidden(path) and not self.show_hidden

0 commit comments

Comments
 (0)