File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from pathlib import Path
2+ import ast
23
34import pytest
45
@@ -33,3 +34,25 @@ def test_safe_key_display_usage_is_centralized():
3334 violations .append (f"{ relative_path } :{ line } " )
3435
3536 assert violations == []
37+
38+
39+ def test_safe_key_display_calls_use_explicit_key_display_keyword ():
40+ missing_keyword_calls : list [str ] = []
41+
42+ for path in _python_files ():
43+ relative_path = path .relative_to (HYPERBROWSER_ROOT )
44+ if relative_path not in ALLOWED_SAFE_KEY_DISPLAY_CALL_FILES :
45+ continue
46+ module = read_module_ast (path )
47+ for node in ast .walk (module ):
48+ if not isinstance (node , ast .Call ):
49+ continue
50+ if not isinstance (node .func , ast .Name ):
51+ continue
52+ if node .func .id != "safe_key_display_for_error" :
53+ continue
54+ if any (keyword .arg == "key_display" for keyword in node .keywords ):
55+ continue
56+ missing_keyword_calls .append (f"{ relative_path } :{ node .lineno } " )
57+
58+ assert missing_keyword_calls == []
You can’t perform that action at this time.
0 commit comments