Skip to content

Commit

Permalink
Use Ruff to prevent various regressions (#2221)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed May 28, 2024
1 parent f1764bf commit 1e00638
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
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

0 comments on commit 1e00638

Please sign in to comment.