Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
q0w committed Jan 22, 2023
1 parent 059d52c commit 7cd7b31
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .lintrunner.toml
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,5 @@ init_command = [
'run',
'pip_init',
'--dry-run={{DRYRUN}}',
'refurb==1.10.0',
'refurb==1.10.0;python_version>="3.10"',
]
6 changes: 3 additions & 3 deletions lintrunner_adapters/adapters/flake8_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_issue_severity(code: str) -> LintSeverity:
# "T49": internal type checker errors or unmatched messages
if any(
code.startswith(x)
for x in [
for x in (
"B9",
"C4",
"C9",
Expand All @@ -143,13 +143,13 @@ def get_issue_severity(code: str) -> LintSeverity:
"E5",
"T400",
"T49",
]
)
):
return LintSeverity.ADVICE

# "F821": Undefined name
# "E999": syntax error
if any(code.startswith(x) for x in ["F821", "E999"]):
if any(code.startswith(x) for x in ("F821", "E999")):
return LintSeverity.ERROR

# "F": PyFlakes Error
Expand Down
6 changes: 3 additions & 3 deletions lintrunner_adapters/adapters/newlines_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ def check_file(filename: str) -> LintMessage | None:
with open(filename, "rb") as f:
lines = f.readlines()

if len(lines) == 0:
if not lines:
# File is empty, just leave it alone.
return None

if len(lines) == 1 and len(lines[0]) == 1:
if len(lines) == len(lines[0]) == 1:
# file is wrong whether or not the only byte is a newline
return LintMessage(
path=filename,
Expand Down Expand Up @@ -77,7 +77,7 @@ def check_file(filename: str) -> LintMessage | None:
for idx, line in enumerate(lines):
if len(line) >= 2 and line[-1] == NEWLINE and line[-2] == CARRIAGE_RETURN:
if not has_changes:
original_lines = list(lines)
original_lines = lines.copy()
has_changes = True
lines[idx] = line[:-2] + b"\n"

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,4 @@ disable = [

[tool.refurb]
python_version = "3.7"
disable = ["FURB101", "FURB150"] # disable suggestions using pathlib

0 comments on commit 7cd7b31

Please sign in to comment.