~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(hooks): skip comments in check-utcnow-parens (#3551)
LearningCircuitc38fd31ce2a3
diff --git a/.pre-commit-hooks/check-utcnow-parens.py b/.pre-commit-hooks/check-utcnow-parens.pyindex f5f6e27bc4..7db4e60f7f 100755--- a/.pre-commit-hooks/check-utcnow-parens.py+++ b/.pre-commit-hooks/check-utcnow-parens.py@@ -32,6 +32,10 @@ def main() -> int:continuefor i, line in enumerate(lines, 1):+ # Skip comment and docstring lines — a note like+ # "# default=utcnow is wrong" should not fire the check.+ if line.lstrip().startswith(("#", '"""', "'''")):+ continueif _BAD_PATTERN.search(line):print(f"{filepath}:{i}: utcnow without parentheses — "diff --git a/tests/hooks/test_check_utcnow_parens.py b/tests/hooks/test_check_utcnow_parens.pyindex bf1b73e63c..3e9b327eb6 100644--- a/tests/hooks/test_check_utcnow_parens.py+++ b/tests/hooks/test_check_utcnow_parens.py@@ -7,6 +7,7 @@ and server_default=utcnow() patterns."""import subprocess+import sysimport tempfilefrom pathlib import Path@@ -24,7 +25,7 @@ def _run_hook(content: str) -> subprocess.CompletedProcess:f.write(content)f.flush()return subprocess.run(- ["python", str(HOOK_SCRIPT), f.name],+ [sys.executable, str(HOOK_SCRIPT), f.name],capture_output=True,text=True,)@@ -136,6 +137,38 @@ class TestAllowsCorrectPatterns:assert result.returncode == 0+# =========================================================================+# Comment / docstring skip (regression)+# =========================================================================+++class TestCommentAndDocstringSkip:+ """Lines that start with a comment or docstring delimiter must not fire,+ even if they contain the literal bad pattern."""++ def test_comment_with_bare_utcnow_not_flagged(self):+ """Key regression: `# default=utcnow is wrong` must not fire."""+ result = _run_hook("# default=utcnow is wrong — use default=utcnow()\n")+ assert result.returncode == 0++ def test_comment_with_onupdate_bare_utcnow_not_flagged(self):+ result = _run_hook("# onupdate=utcnow was the old style\n")+ assert result.returncode == 0++ def test_triple_double_quote_line_not_flagged(self):+ result = _run_hook('"""default=utcnow was the wrong style."""\n')+ assert result.returncode == 0++ def test_triple_single_quote_line_not_flagged(self):+ result = _run_hook("'''default=utcnow was the wrong style.'''\n")+ assert result.returncode == 0++ def test_indented_comment_not_flagged(self):+ """Indented comments also respect the skip."""+ result = _run_hook(" # default=utcnow\n")+ assert result.returncode == 0++# =========================================================================# Output format# =========================================================================