Skip to content

Commit 9c1d129

Browse files
author
Ondrej Machala
committed
chore: add SonarQube config and commit-msg hook
1 parent 46e19d3 commit 9c1d129

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

scripts/commit-msg.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
3+
# Block commits with AI tool co-authors or footprints
4+
# Only humans can bear responsibility for code - commits must be under your name
5+
6+
COMMIT_MSG_FILE="$1"
7+
8+
# Check if commit message file exists
9+
if [ ! -f "$COMMIT_MSG_FILE" ]; then
10+
exit 0
11+
fi
12+
13+
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
14+
15+
# Check for AI co-author patterns
16+
if echo "$COMMIT_MSG" | grep -qiE "Co-Authored-By:.*(Claude|anthropic\.com|openai\.com|GitHub Copilot|Cursor|Codeium)"; then
17+
echo ""
18+
echo " BLOCKED: AI co-author detected"
19+
echo ""
20+
echo " Only humans can bear responsibility for code."
21+
echo " Commits must be authored by you, not an AI assistant."
22+
echo ""
23+
echo " Please remove the Co-Authored-By line and commit under your name."
24+
echo ""
25+
exit 1
26+
fi
27+
28+
# Check for AI-generated signatures
29+
if echo "$COMMIT_MSG" | grep -qiE "Generated (with|by).*(Claude|GPT|Copilot|Cursor|AI)"; then
30+
echo ""
31+
echo " BLOCKED: AI-generated signature detected"
32+
echo ""
33+
echo " Only humans can bear responsibility for code."
34+
echo " You are the author - own your commits."
35+
echo ""
36+
echo " Please remove the 'Generated by' line from your commit message."
37+
echo ""
38+
exit 1
39+
fi
40+
41+
exit 0

sonar-project.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# SonarQube Configuration
2+
3+
# Project identification
4+
sonar.projectKey=heroshot
5+
sonar.projectName=Heroshot
6+
7+
# Source directories
8+
sonar.sources=src,editor/src,docs
9+
10+
# Test directories
11+
sonar.tests=src/tests,editor/src/lib/tests,editor/tests
12+
13+
# Exclude test files from duplication analysis
14+
sonar.cpd.exclusions=**/*.test.ts,**/*.spec.ts,**/tests/**
15+
16+
# Exclude from coverage (already tracked separately)
17+
sonar.coverage.exclusions=**/*.test.ts,**/*.spec.ts,**/tests/**
18+
19+
# TypeScript configuration
20+
sonar.typescript.lcov.reportPaths=coverage/lcov.info

0 commit comments

Comments
 (0)