hav Commit Guard is a VS Code quality gate for staged Git changes.
It scans staged changes before you commit, reporting unresolved TODOs, debug leftovers, merge conflict markers, and matches from custom regex rules.
- Features
- Screenshots
- Default rules
- Commands
- VS Code settings
- Rule format
- Repository hook config
- Commit blocking
- Build from source
- Contributing
- License
- Scans staged Git changes
- Shows findings in the Problems view
- Shows issue counts in the Status Bar
- Opens issues from a Quick Pick
- Automatically rescans when Git state changes
- Falls back to debounced rescans on file save
- Adds Source Control view title buttons for hook install/remove and one-time bypass/clear
- Can install or remove an optional Git
pre-commithook to block commits with errors - Can arm or clear a one-time VS Code bypass for the next commit
- English and German messages for the UI and hook CLI
- Configurable rules
- Repository-level hook configuration via
.hav-commit-guard.json
Find errors and warnings in staged changes.
Block commits when staged errors are found.
Jump directly to staged issues.
| Rule | Severity | Purpose |
|---|---|---|
todo |
warning | Reports TODO comments in code files |
fixme |
error | Blocks FIXME comments in code files |
hack |
error | Blocks HACK comments in code files |
merge-conflict |
error | Blocks conflict markers |
js-console-log |
warning | Reports console.log(...) calls in JavaScript and TypeScript files |
js-debugger |
error | Blocks debugger; statements in JavaScript and TypeScript files |
cpp-debug-output |
warning | Reports std::cout and printf debug leftovers in C/C++ files |
csharp-debug-output |
warning | Reports Console.Write*, Debug.Write*, and Trace.Write* debug leftovers in C# files |
hav Commit Guard: Scan Staged Changeshav Commit Guard: Show Issueshav Commit Guard: Bypass Next Commit Oncehav Commit Guard: Clear Next Commit Bypasshav Commit Guard: Install Git Hookhav Commit Guard: Remove Git Hook
When a Git repository is open, the Source Control view also shows compact buttons for these repository actions:
- Install Git Hook, replaced by Remove Git Hook after this extension's hook is installed
- Bypass Next Commit Once, replaced by Clear Next Commit Bypass while the bypass is armed
{
"havCommitGuard.autoScan": true,
"havCommitGuard.debounceMs": 250,
"havCommitGuard.maxFileSizeKb": 512,
"havCommitGuard.rules": [
{
"id": "todo",
"label": "TODO comment",
"pattern": "\\bTODO\\b:?(.*)",
"severity": "warning",
"filePattern": "\\.(js|jsx|ts|tsx|vue|svelte|c|cc|cpp|cxx|h|hpp|hh|hxx|cs|csx|py|rb|php|go|rs|java|kt|swift|m|mm|scala|sh|bash|zsh|ps1)$"
},
{
"id": "fixme",
"label": "FIXME comment",
"pattern": "\\bFIXME\\b:?(.*)",
"severity": "error",
"filePattern": "\\.(js|jsx|ts|tsx|vue|svelte|c|cc|cpp|cxx|h|hpp|hh|hxx|cs|csx|py|rb|php|go|rs|java|kt|swift|m|mm|scala|sh|bash|zsh|ps1)$"
},
{
"id": "hack",
"label": "HACK comment",
"pattern": "\\bHACK\\b:?(.*)",
"severity": "error",
"filePattern": "\\.(js|jsx|ts|tsx|vue|svelte|c|cc|cpp|cxx|h|hpp|hh|hxx|cs|csx|py|rb|php|go|rs|java|kt|swift|m|mm|scala|sh|bash|zsh|ps1)$"
}
]
}NOTE: By default, TODO/FIXME/HACK rules apply only to code-like files. Non-code files are ignored unless a matching filePattern includes them.
interface havCommitGuardRule {
id: string;
label?: string;
pattern: string;
severity: "off" | "warning" | "error";
filePattern?: string;
}pattern and filePattern are JavaScript regular expressions.
The Git hook runs outside VS Code, so it uses the default rules unless the repository includes this file:
.hav-commit-guard.json
Use .hav-commit-guard.example.json as a starting point.
Errors block commits when the Git hook is installed. Warnings are reported and do not block.
Use hav Commit Guard: Install Git Hook to enable commit blocking for a repository, and hav Commit Guard: Remove Git Hook to disable it again. These commands are available from the Command Palette and as a stateful button in the Source Control view.
Git hook installation respects Git's core.hooksPath. If it is not configured, the extension uses the repository's default .git/hooks/pre-commit.
In restricted or untrusted workspaces, staged-change scanning remains available, but installing or removing the Git hook and changing bypass state require trusting the workspace.
For a deliberate one-time bypass, use:
hav Commit Guard: Bypass Next Commit Once(recommended in VS Code)- or
git commit --no-verify(fallback)
The VS Code bypass is single-use and is consumed by the next commit attempt in that repository.
Use hav Commit Guard: Clear Next Commit Bypass to cancel an armed bypass before committing. The Source Control view bypass button switches to the clear button while the bypass is armed.
Terminal fallback:
git commit --no-verifygit clone https://github.com/Havoc7891/hav-commit-guard.git
cd hav-commit-guard
npm install
npm run compile
npm run packageNOTE: The VSIX package is written to the repository root.
Thank you for your interest! Suggestions for features and bug reports are always welcome via issues.
To maintain a consistent design and quality for this extension, changes are implemented by the maintainer rather than via direct pull requests.
This extension is licensed under the MIT License.


