mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 16:02:05 +00:00
[scheduler] record daily run for deps-security-agent (failed) + format scripts
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
3cb09c3960
commit
7a53be30f3
2 files changed
+47
-27
No files matched your search
@@ -20,29 +20,33 @@ PATTERNS = [
|
||||
(r"# todo", "Found '# todo' comment"),
|
||||
]
|
||||
|
||||
|
||||
def scan_file(filepath):
|
||||
"""Scan a single file for suspicious patterns."""
|
||||
issues = []
|
||||
try:
|
||||
content = filepath.read_text(encoding="utf-8")
|
||||
except Exception:
|
||||
return # Skip non-text files
|
||||
return # Skip non-text files
|
||||
|
||||
for pattern, message in PATTERNS:
|
||||
if re.search(pattern, content):
|
||||
issues.append(message)
|
||||
|
||||
# Check for lack of assertions (very naive)
|
||||
if "test_" in filepath.name and "assert" not in content and "expect" not in content and "raise" not in content:
|
||||
if (
|
||||
"test_" in filepath.name
|
||||
and "assert" not in content
|
||||
and "expect" not in content
|
||||
and "raise" not in content
|
||||
):
|
||||
# Exclude conftest or helpers
|
||||
if "conftest" not in filepath.name and "helper" not in filepath.name:
|
||||
issues.append("No obvious assertions found")
|
||||
issues.append("No obvious assertions found")
|
||||
|
||||
if issues:
|
||||
SUSPICIOUS.append({
|
||||
"file": str(filepath),
|
||||
"issues": issues
|
||||
})
|
||||
SUSPICIOUS.append({"file": str(filepath), "issues": issues})
|
||||
|
||||
|
||||
def main():
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
@@ -62,5 +66,6 @@ def main():
|
||||
print(f"Found {len(SUSPICIOUS)} suspicious files.")
|
||||
print(f"Report written to {OUTPUT_DIR / 'suspicious-tests.json'}.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user