Skip to content

Add ruff.toml and clean up warnings #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions check_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,8 @@ def check_built_config(build):
# Build dictionary of CONFIG_NAME: y/m/n ("is not set" translates to 'n').
configs = {}
with open(".config", encoding='utf-8') as file:
for line in file:
line = line.strip()
if len(line) == 0:
for rawline in file:
if not (line := rawline.strip()):
continue

name = None
Expand Down
2 changes: 1 addition & 1 deletion generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def parse_args(trees):
help='Fail if generating yml files results in a diff')
parser.add_argument(
'trees',
choices=trees + ['all'],
choices=[*trees, 'all'],
default='all',
help='The trees to generate yml files for (default: all)',
metavar='TREES',
Expand Down
28 changes: 28 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# https://beta.ruff.rs/docs/rules/
select = [
'A', # flake8-builtins
'ARG', # flake8-unused-arguments
'B', # flake8-bugbear
'C4', # flake8-comprehensions
'E', # pycodestyle
'F', # pyflakes
'PIE', # flake8-pie
'PL', # pylint
'RET', # flake8-return
'RUF', # ruff
'SIM', # flake8-simplify
'SLF', # flake8-self
'UP', # pyupgrade
'W', # pycodestyle
]
ignore = [
'E501', # line-too-long
'PLR0911', # too-many-return-statments
'PLR0912', # too-many-branches
'PLR0913', # too-many-arguments
'PLR0915', # too-many-statements
'PLR2004', # magic-value-comparison
]
target-version = 'py38'
# Separate repo used as a submodule, ignore it
extend-exclude = ['boot-utils']