FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Cortex/setup_precommit.sh at main · syncopatedNote/Cortex · GitHub
syncopatedNote
Cortex
Repository navigation
Code
Issues
2
(2)
Pull requests
1
(1)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Cortex
/
setup_precommit.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
52 lines (45 loc) · 1.6 KB
Breadcrumbs
Cortex
/
setup_precommit.sh
Copy path
File metadata and controls
executable file
·
52 lines (45 loc) · 1.6 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!
/bin/bash
#
Setup script for pre-commit hooks
set
-e
echo
"
🔧 Setting up pre-commit hooks for credential detection...
"
#
Check if pre-commit is installed
if
!
command
-v pre-commit
&
>
/dev/null
;
then
echo
"
📦 Installing pre-commit...
"
pip install pre-commit
else
echo
"
✅ pre-commit already installed
"
fi
#
Install the git hooks
echo
"
🪝 Installing git hooks...
"
pre-commit install
#
Generate baseline for existing secrets (if any)
echo
"
📊 Scanning existing codebase for secrets...
"
if
command
-v detect-secrets
&
>
/dev/null
;
then
detect-secrets scan --baseline .secrets.baseline
echo
"
✅ Baseline created/updated: .secrets.baseline
"
else
echo
"
⚠️ detect-secrets not found, installing...
"
pip install detect-secrets
detect-secrets scan --baseline .secrets.baseline
fi
#
Run pre-commit on all files to check current state
echo
"
🔍 Running pre-commit checks on all files...
"
pre-commit run --all-files
||
{
echo
"
"
echo
"
⚠️ Some files failed pre-commit checks.
"
echo
"
This is normal on first run. Fix the issues and commit again.
"
exit
0
}
echo
"
"
echo
"
✅ Pre-commit hooks successfully installed!
"
echo
"
"
echo
"
Usage:
"
echo
"
• Hooks run automatically on 'git commit'
"
echo
"
• Run manually: pre-commit run --all-files
"
echo
"
• Update hooks: pre-commit autoupdate
"
echo
"
• Skip hooks (NOT recommended): git commit --no-verify
"
echo
"
"
echo
"
Configuration files:
"
echo
"
• .pre-commit-config.yaml - hook configuration
"
echo
"
• .secrets.baseline - baseline for existing secrets
"
echo
"
• pyproject.toml - Python tool configuration
"
Back
|
FazBrowse Home
|
New Git URL