Skip to content

B7: CodeQL workflow + pre-commit config#5

Merged
jcddc83 merged 1 commit into
mainfrom
claude/codeql-precommit
May 19, 2026
Merged

B7: CodeQL workflow + pre-commit config#5
jcddc83 merged 1 commit into
mainfrom
claude/codeql-precommit

Conversation

@jcddc83

@jcddc83 jcddc83 commented May 18, 2026

Copy link
Copy Markdown
Owner

Summary

Two small security/quality additions:

1. CodeQL workflow (.github/workflows/codeql.yml)
GitHub-native static analysis for Python using the security-and-quality query suite. Triggers on push/PR to main plus a weekly schedule (Mondays 06:23 UTC) so dormant weeks still get a fresh scan. Findings surface under the repo's Security tab.

2. pre-commit config (.pre-commit-config.yaml)
Runs locally before each commit. Hooks:

  • pre-commit-hooks: trailing-whitespace, end-of-file-fixer, check-yaml, check-toml, check-merge-conflict, check-added-large-files (500kb cap), detect-private-key
  • ruff-pre-commit: ruff --fix + ruff-format (same checks CI runs)

A clean local commit ⇒ a green lint run in CI.

CONTRIBUTING.md updated with pip install pre-commit && pre-commit install instructions.

Smoke test

Ran pre-commit run --all-files against the current tree on this branch — all 9 hooks pass.

Stacked on #1

Based on claude/audit-github-repo-EWQDn. Both files only depend on the ruff config that lives in pyproject.toml (added in #1). No conflicts expected with PR #2, #3, or #4 — different files entirely.

Test plan

  • CI green (lint + tests + build)
  • CodeQL workflow runs on this PR and surfaces no critical findings (first scan establishes the baseline)
  • After merge, the Security tab shows CodeQL as active
  • Contributor following the new CONTRIBUTING.md instructions can run pre-commit install and have hooks fire on next commit

Generated by Claude Code

CodeQL (.github/workflows/codeql.yml): GitHub-native static analysis
for Python using the security-and-quality query suite. Triggers on
push/PR to main plus a weekly schedule so dormant weeks still get a
fresh scan. Findings show up under the Security tab.

pre-commit (.pre-commit-config.yaml): runs locally before each commit.
Hooks:
- pre-commit-hooks: trailing-whitespace, end-of-file-fixer, check-yaml,
  check-toml, check-merge-conflict, check-added-large-files (500kb),
  detect-private-key
- ruff-pre-commit: ruff --fix + ruff-format (same checks CI runs)

So a clean local commit means a green lint run in CI.

CONTRIBUTING.md updated with pre-commit install instructions.
Smoke-tested locally: `pre-commit run --all-files` passes on the
current tree.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a0fdef37c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .pre-commit-config.yaml
- id: detect-private-key

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pin Ruff to the same version used in CI

This pins pre-commit Ruff at v0.8.4, but the CI lint job installs ruff without a version pin (.github/workflows/ci.yml line 18), so the two environments will drift. When CI picks up newer Ruff rules/format changes, commits can pass locally via pre-commit and still fail in CI, which breaks the stated “clean local commit ⇒ green CI” guarantee and creates avoidable churn for contributors.

Useful? React with 👍 / 👎.

Base automatically changed from claude/audit-github-repo-EWQDn to main May 19, 2026 15:19
@jcddc83 jcddc83 merged commit dbc0451 into main May 19, 2026
@jcddc83 jcddc83 deleted the claude/codeql-precommit branch May 19, 2026 15:21
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