Skip to content

Commit 37fcb57

Browse files
chore: replace pylint with ruff (#56)
Ruff has substantial overlap in rules with pylint. This PR removes pylint in favour of enabling appropriate pylint rules in the ruff config.
1 parent 5bd7d6e commit 37fcb57

File tree

10 files changed

+12
-307
lines changed

10 files changed

+12
-307
lines changed

.github/workflows/checks.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ jobs:
5555
- name: Run mypy
5656
run: poetry run task mypy
5757

58-
- name: Run pylint
59-
run: poetry run task pylint
60-
6158
- name: Run ruff
6259
run: poetry run task ruff
6360

poetry.lock

Lines changed: 1 addition & 267 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,15 @@ binarylane-python-client = "^0.13.2a0"
2828
safety = "<3.0.0"
2929
ruff = "^0.9.6"
3030

31-
[tool.poetry.group.pylint.dependencies]
32-
pylint = { version = "^3.3.4", python = ">=3.9" }
33-
34-
[tool.poetry.group.pylint-38.dependencies]
35-
pylint = { version = "^2.15.2", python = "<3.9" }
36-
3731
[tool.taskipy.tasks]
3832
generate = "python scripts/generate.py"
3933
black = "black ."
4034
isort = "isort ."
4135
mypy = "mypy ."
4236
ruff = "ruff check src"
43-
pylint = "pylint src"
4437
safety = "poetry export -f requirements.txt | safety check --bare --stdin"
4538
test = "pytest tests"
46-
check = "task isort && task black && task mypy && task ruff && task pylint && task test && task safety"
39+
check = "task isort && task black && task mypy && task ruff && task test && task safety"
4740

4841
[tool.isort]
4942
py_version = 37
@@ -69,23 +62,8 @@ exclude = [
6962
]
7063

7164
[tool.ruff.lint]
72-
select = ["E4", "E7", "E9", "F", "TC"]
73-
74-
[tool.pylint.format]
75-
max-line-length = 120
76-
ignore-paths = ['src/binarylane/console/commands/*/']
77-
78-
[tool.pylint.messages_control]
79-
disable = [
80-
"import-outside-toplevel", # CLI programs need delayed import
81-
"design", # design checker is too opinionated
82-
"fixme", # FIXME: initial impl in progress
83-
84-
# Checkbox documentation is bad:
85-
"missing-module-docstring",
86-
"missing-class-docstring",
87-
"missing-function-docstring",
88-
]
65+
select = ["E4", "E7", "E9", "F", "TC", "PL"]
66+
ignore = ["PLR"]
8967

9068
[tool.mypy]
9169
disallow_any_generics = true

src/binarylane/console/__main__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ def main() -> int:
1818
App().run(sys.argv[1:])
1919
return 0
2020

21-
# pylint: disable=broad-except
2221
except Exception as exc:
2322
logger.exception(exc)
2423
return -1

src/binarylane/console/parser/list_attribute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def __init__(
4343
option_name: Optional[str] = None,
4444
description: Optional[str] = None,
4545
) -> None:
46-
# pylint: disable=duplicate-code
4746
super().__init__(
4847
attribute_name,
4948
attribute_type,

src/binarylane/console/parser/parser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from binarylane.console.parser.object_attribute import Mapping
1616

17-
ArgumentGroup: TypeAlias = argparse._ArgumentGroup # pylint: disable=protected-access
17+
ArgumentGroup: TypeAlias = argparse._ArgumentGroup
1818

1919
logger = logging.getLogger(__name__)
2020

src/binarylane/console/parser/primitive_attribute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def lookup(self, value: str) -> object:
163163
# If not, perform a lookup using the provided value
164164
result = self._lookup(value)
165165
if result is None:
166-
# pylint: disable=raise-missing-from
167166
raise argparse.ArgumentError(None, f"{self.attribute_name.upper()}: could not find '{value}'")
168167
return result
169168

src/binarylane/console/printers/formatter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ def _flatten(values: Sequence[Any], single_object: bool = False) -> List[str]:
7777
max_str = 80 if not single_object else 240
7878
trunc = "..."
7979

80-
for item in values:
80+
for value in values:
81+
item = value
8182
item_type = type(item)
8283
if item_type is list:
8384
if len(item) > max_list:

src/binarylane/console/runners/httpx_wrapper.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def __init__(self) -> None:
2727
_httpx_request: Optional[Callable[..., httpx.Response]]
2828

2929
def __enter__(self: WrapperT) -> WrapperT:
30-
# pylint: disable=used-before-assignment
3130
self._httpx_request = httpx.request
3231
httpx.request = self.request
3332
return self
@@ -42,11 +41,10 @@ def request(self, *args: Any, **kwargs: Any) -> httpx.Response:
4241
def __exit__(
4342
self, exc_type: Optional[type[BaseException]], exc_val: Optional[BaseException], exc_tb: Optional[TracebackType]
4443
) -> None:
45-
# pylint: disable=used-before-assignment
4644
httpx.request = self._httpx_request # type: ignore
4745

4846

49-
class CurlCommand(HttpxWrapper): # pylint: disable=too-few-public-methods
47+
class CurlCommand(HttpxWrapper):
5048
"""Convert HTTP request to a curl command-line. The HTTP request is not performed."""
5149

5250
shell: str

src/binarylane/pycompat/actions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ def __init__(
1313
option_strings: Sequence[str],
1414
dest: str,
1515
default: Union[object, str, None] = None,
16-
type: Union[Callable[[str], object], argparse.FileType, None] = None, # pylint: disable=redefined-builtin
16+
type: Union[Callable[[str], object], argparse.FileType, None] = None,
1717
choices: Union[Iterable[object], None] = None,
1818
required: bool = False,
19-
help: Union[str, None] = None, # pylint: disable=redefined-builtin
19+
help: Union[str, None] = None,
2020
metavar: Union[str, Tuple[str, ...], None] = None,
2121
) -> None:
2222
_option_strings = []
2323
for option_string in option_strings:
2424
_option_strings.append(option_string)
2525

2626
if option_string.startswith("--"):
27-
option_string = "--no-" + option_string[2:]
28-
_option_strings.append(option_string)
27+
negative_option_string = "--no-" + option_string[2:]
28+
_option_strings.append(negative_option_string)
2929

3030
if help is not None and default is not None and default is not argparse.SUPPRESS:
3131
help += " (default: %(default)s)"

0 commit comments

Comments
 (0)