Skip to content

feat(betterleaks): pre-commit-framework template for repos#38

Merged
dkastl merged 1 commit into
mainfrom
feat/pre-commit-betterleaks-template
May 19, 2026
Merged

feat(betterleaks): pre-commit-framework template for repos#38
dkastl merged 1 commit into
mainfrom
feat/pre-commit-betterleaks-template

Conversation

@dkastl

@dkastl dkastl commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds `betterleaks/.pre-commit-config.example.yaml`: an opt-in template that wires the same betterleaks ruleset into each developer's local git workflow.

Once a repo copies this to `.pre-commit-config.yaml` and a developer runs `pre-commit install` on their laptop, `git commit` refuses to create commits containing secrets. Same rules as the per-PR Secret Leak Check, so feedback is consistent before and after pushing.

Defaults

  • Pinned to betterleaks v1.2.0 (matches the per-PR scan workflow).
  • Docker variant by default (no Go/Rust toolchain needed; Mac/Linux devs typically already have Docker for CDK / n8n work).
  • Golang and system variants documented as alternatives.

What this is not

  • Not enforced; opt-in per developer (`pre-commit install`).
  • Bypassable with `git commit --no-verify`.
  • The per-PR Secret Leak Check on the server side remains the hard gate.

Test plan

  • CodeRabbit clean
  • After merge, the TechDocs handbook gets a section pointing here (separate PR in geolonia-operations)

Summary by CodeRabbit

  • Documentation
    • Added example pre-commit configuration file to help users set up Betterleaks for automated secret detection during commits.

Review Change Stack

Adds `betterleaks/.pre-commit-config.example.yaml`: a ready-to-copy
.pre-commit-config.yaml that wires the same betterleaks ruleset into
the developer's local git workflow.

Setup once per laptop:

  pip install pre-commit   # or: brew install pre-commit
  pre-commit install

After that, `git commit` runs betterleaks on the staged diff and
refuses to create the commit when a secret is detected. Same rules
as the per-PR Secret Leak Check, so the local feedback matches what
the PR check would say.

Pinned to betterleaks v1.2.0, matching the per-PR scan workflow.
Uses the Docker variant by default (no Go/Rust toolchain needed),
with golang and system variants documented as alternatives.

Companion TechDocs handbook update goes in geolonia/geolonia-operations.
@coderabbitai

coderabbitai Bot commented May 19, 2026

Copy link
Copy Markdown

Walkthrough

A new example pre-commit configuration file for Betterleaks is added, documenting hook installation, setup instructions, and the Docker-based hook pinned to version 1.2.0 with commented non-Docker alternatives.

Changes

Betterleaks Pre-commit Configuration Example

Layer / File(s) Summary
Example pre-commit configuration
betterleaks/.pre-commit-config.example.yaml
Template configuration demonstrates Betterleaks hook setup, including installation instructions, the betterleaks-docker hook pinned to rev: v1.2.0, and commented guidance for alternative non-Docker hook identifiers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding a pre-commit framework template for betterleaks that enables local secret detection.
Description check ✅ Passed The description comprehensively covers the purpose, defaults, scope, and testing approach, matching the repository's template structure with Summary, optional Checklist, and Related Issues sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pre-commit-betterleaks-template

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

Secret Leak Check

OK No secrets detected in this PR's diff.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@betterleaks/.pre-commit-config.example.yaml`:
- Line 11: The line containing the fragment "The same rule set as the per-PR
Secret Leak Check" is missing a verb; update that sentence in
betterleaks/.pre-commit-config.example.yaml to a complete sentence such as "This
uses the same rule set as the per-PR Secret Leak Check" (or "The same rule set
is used as the per-PR Secret Leak Check") so the sentence is grammatically
correct and self-contained.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f6140f24-6d4f-4a8b-bfbd-82a59061da61

📥 Commits

Reviewing files that changed from the base of the PR and between 69514e8 and 14a2417.

📒 Files selected for processing (1)
  • betterleaks/.pre-commit-config.example.yaml

#
# After that, `git commit` runs Betterleaks on the staged diff and refuses
# to create the commit if a secret is detected. The same rule set as the
# per-PR Secret Leak Check, so feedback is consistent between the two.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix incomplete sentence.

The sentence fragment "The same rule set as the per-PR Secret Leak Check" is missing a verb.

📝 Proposed fix
-# to create the commit if a secret is detected. The same rule set as the
+# to create the commit if a secret is detected. Uses the same rule set as the
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@betterleaks/.pre-commit-config.example.yaml` at line 11, The line containing
the fragment "The same rule set as the per-PR Secret Leak Check" is missing a
verb; update that sentence in betterleaks/.pre-commit-config.example.yaml to a
complete sentence such as "This uses the same rule set as the per-PR Secret Leak
Check" (or "The same rule set is used as the per-PR Secret Leak Check") so the
sentence is grammatically correct and self-contained.

@dkastl dkastl merged commit e8bb3d2 into main May 19, 2026
2 checks passed
@dkastl dkastl deleted the feat/pre-commit-betterleaks-template branch May 19, 2026 22:47
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.

1 participant