Skip to content
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

Use Ruff to prevent various regressions #2221

Merged
merged 14 commits into from
May 28, 2024
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
2 changes: 1 addition & 1 deletion com/win32comext/adsi/demos/scp.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def AllowAccessToScpProperties(
setattr(scpObject, attribute, sd)
# SetInfo updates the SCP object in the directory.
scpObject.SetInfo()
logger.info(f"Set security on object for account '{trustee}'")
logger.info("Set security on object for account %r", trustee)


# Service Principal Names functions from the same sample.
Expand Down
24 changes: 24 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,27 @@ target-version = "py37"

[lint]
select = [
"C4", # flake8-comprehensions
"F811", # redefined-while-unused
"I", # isort
"PLC", # Pylint Convention
"PLE", # Pylint Error
"RSE", # flake8-raise
"W", # pycodestyle Warning
"YTT", # flake8-2020

# String formatting, concatenating, interpolation, ...
"ISC001", # single-line-implicit-string-concatenation
# TODO: Do in a separate PR
# "ISC002", # multi-line-implicit-string-concatenation
"FLY", # static-join-to-f-string
"G", # flake8-logging-format
"UP025", # Remove unicode literals from strings
"UP030", # Use implicit references for positional format fields
# TODO: Still lots of manual fixes needed
# "UP031", # Use format specifiers instead of percent format
# "UP032", # Use f-string instead of format call

# Ensure modern type annotation syntax and best practices
# Not including those covered by type-checkers
"FA", # flake8-future-annotations
Expand All @@ -19,6 +38,8 @@ select = [
[lint.per-file-ignores]
# Explicit re-exports is fine in __init__.py, still a code smell elsewhere.
"__init__.py" = ["PLC0414"]
# TODO: Make adodbapi changes in their own PRs
"adodbapi/*" = ["C4", "YTT301", "UP031", "UP032", "ISC002"]

[lint.isort]
combine-as-imports = true
Expand All @@ -33,3 +54,6 @@ known-third-party = [
"distutils",
]
extra-standard-library = ["setuptools"]

[lint.flake8-implicit-str-concat]
allow-multiline = false # ignore ISC003 with this option disabled
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2132,7 +2132,7 @@ def convert_optional_data_files(files):
except RuntimeError as details:
if not str(details.args[0]).startswith("No file"):
raise
logging.info("NOTE: Optional file %s not found - skipping" % file)
logging.info("NOTE: Optional file %s not found - skipping", file)
else:
ret.append(temp[0])
return ret
Expand Down
Loading