Skip to content

Commit

Permalink
ruff: enable PLR rules and fix bug in my.github.gdpr._is_bot
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Aug 27, 2024
1 parent c3da26a commit f563dee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion my/github/gdpr.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _parse_repository(d: Dict) -> Event:
def _is_bot(user: Optional[str]) -> bool:
if user is None:
return False
return "[bot]" in "user"
return "[bot]" in user


def _parse_issue_comment(d: Dict) -> Event:
Expand Down
16 changes: 16 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ lint.extend-select = [
"UP", # detect deprecated python stdlib stuff
"FBT", # detect use of boolean arguments
"RUF", # various ruff-specific rules

"PLR",
# "S", # bandit (security checks) -- tends to be not very useful, lots of nitpicks
# "DTZ", # datetimes checks -- complaining about missing tz and mostly false positives
]

lint.ignore = [
Expand Down Expand Up @@ -41,4 +45,16 @@ lint.ignore = [
###
"RUF100", # unused noqa -- handle later
"RUF012", # mutable class attrs should be annotated with ClassVar... ugh pretty annoying for user configs

### these are just nitpicky, we usually know better
"PLR0911", # too many return statements
"PLR0912", # too many branches
"PLR0913", # too many function arguments
"PLR0915", # too many statements
"PLR1714", # consider merging multiple comparisons
"PLR2044", # line with empty comment
"PLR5501", # use elif instead of else if
"PLR2004", # magic value in comparison -- super annoying in tests
###
"PLR0402", # import X.Y as Y -- TODO maybe consider enabling it, but double check
]

0 comments on commit f563dee

Please sign in to comment.