Skip to content

Commit d833f9f

Browse files
switch pylint to ruff
1 parent ab72b01 commit d833f9f

28 files changed

Lines changed: 131 additions & 216 deletions

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ dmypy.json
118118

119119
.DS_Store
120120

121+
# lint
122+
.ruff_cache/
123+
121124
# api_reference is an auto-generated part of the docs that is based on the source
122125
# code docstrings, so don't have git track these files
123126
docs/api_reference

docs/async_commands/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.. _async-commands:
2+
23
Async Commands
34
==============
45

examples/cake.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
CAKES = []
1919

2020

21-
# pylint: disable=bad-continuation
2221
@recline.command(name="cake make")
2322
def make_cake(
2423
layers: RangedInt.define(min=2, max=10),

examples/ls

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ def render_output(output_items):
129129
print(row)
130130

131131

132-
# pylint: disable=bad-continuation,invalid-name
133132
@recline.command
134133
def ls(
135134
path: Positional = ".",

poetry.lock

Lines changed: 31 additions & 115 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pyreadline3 = {version = "^3.4.1", markers = "sys_platform == 'win32'"}
2828

2929
[tool.poetry.group.dev.dependencies]
3030
pudb = "^2025.1.5"
31-
pylint = "^4.0.5"
31+
ruff = "^0.15.11"
3232
pytest = "^9.0.2"
3333
pytest-cov = "^7.1.0"
3434
sphinx = "^8.1.0"
@@ -40,3 +40,6 @@ importlib-metadata = "^9.0.0"
4040
requires = ["poetry-core>=2.0.0,<3.0.0"]
4141
build-backend = "poetry.core.masonry.api"
4242

43+
[tool.ruff]
44+
exclude = ["recline/vendor"]
45+

recline/__init__.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
Original © NetApp 2024
33
"""
44

5-
import os
6-
import sys
7-
85
PROGRAM_NAME = None
96
PROMPT = '> '
107
NEXT_JOB_PID = 1
118
JOBS = {}
129

13-
from recline.commands.cli_command import command # pylint: disable=wrong-import-position
14-
from recline.repl.shell import relax # pylint: disable=wrong-import-position
10+
from recline.commands.cli_command import command # noqa: E402
11+
from recline.repl.shell import relax # noqa: E402
1512

1613
__all__ = ['PROGRAM_NAME', 'PROMPT', 'command', 'relax']

recline/arg_types/choices.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
for a parameter. Once the body of the function is invoked, it is guaranteed that
66
the validation was done on the parameter to make sure it matched one.
77
8-
@recline.command(name="cake make")
9-
def make_cake(flavor: Choices.define(["chocolate", "vanilla", "marble"])) -> None:
10-
# We can assume flavor is one of the choices in the body of the function
8+
.. code-block:: python
9+
10+
@recline.command(name="cake make")
11+
def make_cake(flavor: Choices.define(["chocolate", "vanilla", "marble"])) -> None:
12+
# We can assume flavor is one of the choices in the body of the function
1113
"""
1214

1315
from typing import Callable
@@ -44,6 +46,7 @@ def define(
4446
the "*", "|", or ".." query characters. If these characters are
4547
present, then no validation will be done on the value (and validation
4648
is assumed to be done on whatever the command is calling)
49+
4750
data_type: The type of data that represents this argument
4851
"""
4952

@@ -57,12 +60,12 @@ def validate(self, arg):
5760
)
5861
try:
5962
return data_type(arg)
60-
except Exception: # pylint: disable=broad-except
63+
except Exception:
6164
raise ReclineTypeError(f'Unable to convert "{arg}" to type {data_type}')
6265

6366
def choices(self, eager=False):
6467
if hasattr(self.__class__, '_cached_choices'):
65-
return self.__class__._cached_choices # pylint: disable=protected-access
68+
return self.__class__._cached_choices
6669

6770
# don't call the completer function unless we're sure we want to
6871
if not eager and not isinstance(available_choices, list):
@@ -74,7 +77,7 @@ def choices(self, eager=False):
7477

7578
current_choices = [str(c) for c in current_choices]
7679
if cache_choices:
77-
self.__class__._cached_choices = current_choices # pylint: disable=protected-access
80+
self.__class__._cached_choices = current_choices
7881
self.__class__.metavar = f"<{'|'.join(current_choices)}>"
7982
return current_choices
8083

recline/arg_types/flag.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
is a flag. If it is a bool, then the user must provide either "true" or "false"
88
explicitly on the command line.
99
10-
@recline.command
11-
def ls(l: Flag = None) -> None:
12-
# If the user provided "-l" then l will be set to True. Else l will be None
10+
.. code-block:: python
11+
12+
@recline.command
13+
def ls(l: Flag = None) -> None:
14+
# If the user provided "-l" then l will be set to True. Else l will be None
1315
"""
1416

1517
from recline.arg_types.recline_type import ReclineType

recline/arg_types/positional.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
user will provide positionally. That is, instead of the user typing
66
"-arg_name argvalue", they can just type "argvalue". For example:
77
8-
@recline.command
9-
def ls(path: Positional = ".") -> None:
10-
# If the user provided "ls my_dir", then path will be set to "my_dir". If the
11-
# user just said "ls", then path will be set to ".".
8+
.. code-block:: python
9+
10+
@recline.command
11+
def ls(path: Positional = ".") -> None:
12+
# If the user provided "ls my_dir", then path will be set to "my_dir". If the
13+
# user just said "ls", then path will be set to ".".
1214
"""
1315

1416
from recline.arg_types.recline_type import ReclineType

0 commit comments

Comments
 (0)