Skip to content

chore: clean up code scanning alerts (replace Codacy with CodeQL + pylint) - #1

Merged
driedel merged 5 commits into
mainfrom
chore/code-scanning-cleanup
Sep 18, 2026
Merged

driedel merged 5 commits into
mainfrom
chore/code-scanning-cleanup

Conversation

@driedel

@driedel driedel commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Context

The Security → Code scanning tab had 166 open alerts, all generated by the Codacy Analysis CLI workflow. Analysis showed the vast majority were tooling noise, not real code issues:

  • The Codacy CLI bundles three outdated linters (Pylint 1.9.5 — Python 2 era, Pylint-python3 2.6.0, Prospector 1.2.0), reporting every issue 2–3×
  • Old Pylint doesn't understand modern Python: from __future__ import annotations, re.Match, pathlib, subprocess text= → false positives
  • Formatting rules removed from Pylint 2.6+ (bad-whitespace, bad-continuation) conflicting with the project's Black-style alignment
  • Project dependencies were never installed in the scan environment → import-error spam

Changes

  • ci(security): replace Codacy with native CodeQL (github/codeql-action, Python); delete codacy.yml + .codacy.yml
  • ci(tests): add a blocking pylint 3.x step to tests.yml; merge .pylintrc — re-enable docstring/line-length/complexity rules (now satisfied) while keeping the original author's pragmatic DESIGN thresholds
  • refactor(worker): extract helpers (_fetch, _scrape, _postprocess, _deploy, _find_local_assets, _save_as_modern_format, _fix_css_format_hints, _clean_html_files, _clean_css_files) — no behavior changes, pipeline messages and ordering preserved
  • style: add missing docstrings, explicit exception chaining (raise ... from None), E306 blank lines, idiomatic asserts
  • docs(agents): refresh CI workflow docs

Validation (inside Docker, per AGENTS.md)

  • ✅ pytest tests/ -q → 105 passed
  • ✅ pylint api worker tests → 10.00/10
  • ✅ Workflow YAML validated

After merge

The 166 stale Codacy alerts must be bulk-dismissed (the tool no longer uploads). I'll handle that via gh api once CodeQL has run on main and is confirmed clean.

The Codacy Analysis CLI bundles three outdated linters (Pylint 1.9.5,
Pylint-python3 2.6.0, Prospector 1.2.0) that reported every issue 2-3x
and produced hundreds of false positives on modern Python syntax.
Replace it with the native github/codeql-action workflow (Python) and
drop the now-unused .codacy.yml engine config.
Run modern Pylint (3.x) with all dependencies installed so import
resolution works, and tighten .pylintrc: docstring, line-length and
complexity rules are now enforced, with pragmatic DESIGN thresholds
and justified disables (test patching patterns, per-file error
tolerance, compiled Rust extensions).
- jobs.py: add _fetch() shared by the three wget call sites, _base_origin(),
  _elementor_targets(), and split deploy_page into _scrape/_postprocess/_deploy
  pipeline steps
- optimize.py: add _find_local_assets(), _save_as_modern_format() and
  _fix_css_format_hints()
- postprocess.py: split main() into _clean_html_files/_clean_css_files and
  move the module docstring above the imports

No behavior changes; pipeline messages and ordering are preserved.
- add docstrings to FastAPI handlers, deploy/worker/optimize entrypoints
  and nested test helpers
- raise HTTPException/RuntimeError with explicit exception chaining
- blank line before nested defs (E306), idiomatic emptiness and
  comparison-order asserts in tests
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@driedel
driedel merged commit a52c636 into main Sep 18, 2026
3 checks passed
@driedel
driedel deleted the chore/code-scanning-cleanup branch November 23, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants