MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / audit

Function audit

scripts/website/audit_source_urls.py:53–87  ·  view source on GitHub ↗
(root: Path)

Source from the content-addressed store, hash-verified

51
52
53def audit(root: Path) -> List[Finding]:
54 findings: List[Finding] = []
55 for file_path in sorted(iter_files(root)):
56 if not file_path.is_file():
57 continue
58 rel = file_path.relative_to(root)
59 text = file_path.read_text(encoding="utf-8", errors="ignore")
60 for idx, line in enumerate(text.splitlines(), start=1):
61 if should_ignore_line(line):
62 continue
63
64 for match in ABS_CN1_RE.finditer(line):
65 url = match.group(0)
66 findings.append(
67 Finding(
68 kind="ABSOLUTE_CN1_URL",
69 file=rel,
70 line_no=idx,
71 url=url,
72 suggestion=suggestion_for_abs(url),
73 )
74 )
75
76 wp_match = WP_RE.search(line)
77 if wp_match:
78 findings.append(
79 Finding(
80 kind="WORDPRESS_URL",
81 file=rel,
82 line_no=idx,
83 url=wp_match.group(0),
84 suggestion="Replace with current migrated site path/resource.",
85 )
86 )
87 return findings
88
89
90def write_report(findings: List[Finding], report_file: Path) -> None:

Callers 1

mainFunction · 0.85

Calls 7

should_ignore_lineFunction · 0.85
FindingClass · 0.85
suggestion_for_absFunction · 0.85
iter_filesFunction · 0.70
groupMethod · 0.65
appendMethod · 0.65
searchMethod · 0.45

Tested by

no test coverage detected