mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-07-04 16:23:04 +02: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] = []
|
||||
ply_line_re = __import__("re").compile(r"^\s*(\d+)\s")
|
||||
# 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:
|
||||
lines.append(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
|
||||
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 ""
|
||||
ret = proc.wait()
|
||||
analysis_text = "".join(lines)
|
||||
|
||||
@ -34,7 +34,6 @@ ignore = [
|
||||
"COM812", # Trailing comma missing (conflicts with formatter)
|
||||
"ISC001", # Implicit string concatenation (conflicts with formatter)
|
||||
# Relaxed for script-heavy repository
|
||||
"S101", # Use of assert - acceptable in this codebase
|
||||
"ANN001", # Missing type annotation for function argument
|
||||
"ANN002", # Missing type annotation for *args
|
||||
"ANN003", # Missing type annotation for **kwargs
|
||||
@ -102,6 +101,9 @@ unfixable = []
|
||||
"S101", # Allow assert in tests
|
||||
"PLR2004", # Allow magic values in tests
|
||||
]
|
||||
"**/test_*.py" = [
|
||||
"S101", # Allow assert in tests
|
||||
]
|
||||
"**/conftest.py" = [
|
||||
"D100", # Allow missing module docstring
|
||||
"D103", # Allow missing function docstring
|
||||
|
||||
Loading…
Reference in New Issue
Block a user