Skip to content

Commit

Permalink
Fix ruff alert (currently) not caught by pre-commit
Browse files Browse the repository at this point in the history
SIM108 [*] Use ternary operator `... = ... if ... else ...` instead of `if`-`else`-block
  • Loading branch information
DimitriPapadopoulos committed Oct 21, 2023
1 parent 0d816cd commit 4a66bbe
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions codespell_lib/_codespell.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,7 @@ def _split_lines(self, text: str, width: int) -> List[str]:
for part in parts:
# Eventually we could allow others...
indent_start = "- "
if part.startswith(indent_start):
offset = len(indent_start)
else:
offset = 0
offset = len(indent_start) if part.startswith(indent_start) else 0
part = part[offset:]
part = self._whitespace_matcher.sub(" ", part).strip()
parts = textwrap.wrap(part, width - offset)
Expand Down Expand Up @@ -1123,10 +1120,7 @@ def main(*args: str) -> int:
if not options.colors or sys.platform == "win32":
colors.disable()

if options.summary:
summary = Summary()
else:
summary = None
summary = Summary() if options.summary else None

context = None
if options.context is not None:
Expand Down

0 comments on commit 4a66bbe

Please sign in to comment.