mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-22 09:02:16 +01:00
Enable S101: replace assert with explicit checks in non-test code
- Replaced assert with RuntimeError in lichess_bot/main.py - Added per-file-ignore for test_*.py pattern
This commit is contained in:
parent
3f793d2d17
commit
b5bb4ec9aa
@ -295,7 +295,9 @@ def run_bot(log_level: str = "INFO", decline_correspondence: bool = False) -> No
|
|||||||
lines: list[str] = []
|
lines: list[str] = []
|
||||||
ply_line_re = __import__("re").compile(r"^\s*(\d+)\s")
|
ply_line_re = __import__("re").compile(r"^\s*(\d+)\s")
|
||||||
# Read stdout line by line
|
# Read stdout line by line
|
||||||
assert proc.stdout is not None
|
if proc.stdout is None:
|
||||||
|
msg = "subprocess stdout is None"
|
||||||
|
raise RuntimeError(msg)
|
||||||
for line in proc.stdout:
|
for line in proc.stdout:
|
||||||
lines.append(line)
|
lines.append(line)
|
||||||
m = ply_line_re.match(line)
|
m = ply_line_re.match(line)
|
||||||
@ -321,7 +323,9 @@ def run_bot(log_level: str = "INFO", decline_correspondence: bool = False) -> No
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Capture any remaining stderr and ensure process ends
|
# Capture any remaining stderr and ensure process ends
|
||||||
assert proc.stderr is not None
|
if proc.stderr is None:
|
||||||
|
msg = "subprocess stderr is None"
|
||||||
|
raise RuntimeError(msg)
|
||||||
stderr_text = proc.stderr.read() or ""
|
stderr_text = proc.stderr.read() or ""
|
||||||
ret = proc.wait()
|
ret = proc.wait()
|
||||||
analysis_text = "".join(lines)
|
analysis_text = "".join(lines)
|
||||||
|
|||||||
@ -34,7 +34,6 @@ ignore = [
|
|||||||
"COM812", # Trailing comma missing (conflicts with formatter)
|
"COM812", # Trailing comma missing (conflicts with formatter)
|
||||||
"ISC001", # Implicit string concatenation (conflicts with formatter)
|
"ISC001", # Implicit string concatenation (conflicts with formatter)
|
||||||
# Relaxed for script-heavy repository
|
# Relaxed for script-heavy repository
|
||||||
"S101", # Use of assert - acceptable in this codebase
|
|
||||||
"ANN001", # Missing type annotation for function argument
|
"ANN001", # Missing type annotation for function argument
|
||||||
"ANN002", # Missing type annotation for *args
|
"ANN002", # Missing type annotation for *args
|
||||||
"ANN003", # Missing type annotation for **kwargs
|
"ANN003", # Missing type annotation for **kwargs
|
||||||
@ -102,6 +101,9 @@ unfixable = []
|
|||||||
"S101", # Allow assert in tests
|
"S101", # Allow assert in tests
|
||||||
"PLR2004", # Allow magic values in tests
|
"PLR2004", # Allow magic values in tests
|
||||||
]
|
]
|
||||||
|
"**/test_*.py" = [
|
||||||
|
"S101", # Allow assert in tests
|
||||||
|
]
|
||||||
"**/conftest.py" = [
|
"**/conftest.py" = [
|
||||||
"D100", # Allow missing module docstring
|
"D100", # Allow missing module docstring
|
||||||
"D103", # Allow missing function docstring
|
"D103", # Allow missing function docstring
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user