[ruff] Add 'consider-using-in' from pylint
See https://pylint.readthedocs.io/en/latest/user_guide/messages/refactor/consider-using-in.html An automated fix from ruff is available (but it's unsafe for now).
This commit is contained in:
parent
7690a0ddf1
commit
1180348303
|
@ -104,6 +104,7 @@ select = [
|
|||
"W", # pycodestyle
|
||||
"PIE", # flake8-pie
|
||||
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa
|
||||
"PLR1714", # Consider merging multiple comparisons
|
||||
]
|
||||
ignore = [
|
||||
# bugbear ignore
|
||||
|
|
|
@ -289,7 +289,7 @@ def get_user_id() -> int | None:
|
|||
# mypy follows the version and platform checking expectation of PEP 484:
|
||||
# https://mypy.readthedocs.io/en/stable/common_issues.html?highlight=platform#python-version-and-system-platform-checks
|
||||
# Containment checks are too complex for mypy v1.5.0 and cause failure.
|
||||
if sys.platform == "win32" or sys.platform == "emscripten":
|
||||
if sys.platform in {"win32", "emscripten"}:
|
||||
# win32 does not have a getuid() function.
|
||||
# Emscripten has a return 0 stub.
|
||||
return None
|
||||
|
|
|
@ -624,7 +624,7 @@ class LogXML:
|
|||
def update_testcase_duration(self, report: TestReport) -> None:
|
||||
"""Accumulate total duration for nodeid from given report and update
|
||||
the Junit.testcase with the new total if already created."""
|
||||
if self.report_duration == "total" or report.when == self.report_duration:
|
||||
if self.report_duration in {"total", report.when}:
|
||||
reporter = self.node_reporter(report)
|
||||
reporter.duration += getattr(report, "duration", 0.0)
|
||||
|
||||
|
|
|
@ -1787,7 +1787,7 @@ class Function(PyobjMixin, nodes.Item):
|
|||
ntraceback = Traceback(
|
||||
(
|
||||
entry
|
||||
if i == 0 or i == len(ntraceback) - 1
|
||||
if i in {0, len(ntraceback) - 1}
|
||||
else entry.with_repr_style("short")
|
||||
)
|
||||
for i, entry in enumerate(ntraceback)
|
||||
|
|
|
@ -381,7 +381,7 @@ class TerminalReporter:
|
|||
if self.config.getoption("setupshow", False):
|
||||
return False
|
||||
cfg: str = self.config.getini("console_output_style")
|
||||
if cfg == "progress" or cfg == "progress-even-when-capture-no":
|
||||
if cfg in {"progress", "progress-even-when-capture-no"}:
|
||||
return "progress"
|
||||
elif cfg == "count":
|
||||
return "count"
|
||||
|
|
|
@ -429,7 +429,7 @@ class TestAssertionRewrite:
|
|||
|
||||
def f2() -> None:
|
||||
x = 1
|
||||
assert x == 1 or x == 2
|
||||
assert x == 1 or x == 2 # noqa: PLR1714
|
||||
|
||||
getmsg(f2, must_pass=True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue