- Updated file permissions in certificate_service_test.go and log_service_test.go to use octal notation. - Added a new doc.go file to document the services package. - Enhanced error handling in docker_service.go, log_service.go, notification_service.go, proxyhost_service.go, remoteserver_service.go, update_service.go, and uptime_service.go by logging errors when closing resources. - Improved log_service.go to simplify log file processing and deduplication. - Introduced CRUD tests for notification templates in notification_service_template_test.go. - Removed the obsolete python_compile_check.sh script. - Updated notification_service.go to improve template management functions. - Added tests for uptime service notifications in uptime_service_notification_test.go.
96 lines
3.2 KiB
YAML
96 lines
3.2 KiB
YAML
repos:
|
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
rev: v4.6.0
|
|
hooks:
|
|
- id: end-of-file-fixer
|
|
exclude: '^(frontend/(coverage|dist|node_modules|\.vite)/|.*\.tsbuildinfo$)'
|
|
- id: trailing-whitespace
|
|
exclude: '^(frontend/(coverage|dist|node_modules|\.vite)/|.*\.tsbuildinfo$)'
|
|
- id: check-yaml
|
|
- id: check-added-large-files
|
|
args: ['--maxkb=2500']
|
|
- repo: local
|
|
hooks:
|
|
- id: dockerfile-check
|
|
name: dockerfile validation
|
|
entry: tools/dockerfile_check.sh
|
|
language: script
|
|
files: "Dockerfile.*"
|
|
pass_filenames: true
|
|
- id: go-test-coverage
|
|
name: Go Test Coverage
|
|
entry: scripts/go-test-coverage.sh
|
|
language: script
|
|
pass_filenames: false
|
|
verbose: true
|
|
always_run: true
|
|
- id: go-vet
|
|
name: Go Vet
|
|
entry: bash -c 'cd backend && go vet ./...'
|
|
language: system
|
|
files: '\.go$'
|
|
pass_filenames: false
|
|
- id: check-version-match
|
|
name: Check .version matches latest Git tag
|
|
entry: bash -c 'scripts/check-version-match-tag.sh'
|
|
language: system
|
|
files: '\.version$'
|
|
pass_filenames: false
|
|
|
|
# === MANUAL/CI-ONLY HOOKS ===
|
|
# These are slow and should only run on-demand or in CI
|
|
# Run manually with: pre-commit run golangci-lint --all-files
|
|
- id: go-test-race
|
|
name: Go Test Race (Manual)
|
|
entry: bash -c 'cd backend && go test -race ./...'
|
|
language: system
|
|
files: '\.go$'
|
|
pass_filenames: false
|
|
stages: [manual] # Only runs when explicitly called
|
|
|
|
- id: golangci-lint
|
|
name: GolangCI-Lint (Manual)
|
|
entry: bash -c 'cd backend && docker run --rm -v $(pwd):/app:ro -w /app golangci/golangci-lint:latest golangci-lint run -v'
|
|
language: system
|
|
files: '\.go$'
|
|
pass_filenames: false
|
|
stages: [manual] # Only runs when explicitly called
|
|
|
|
- id: hadolint
|
|
name: Hadolint Dockerfile Check (Manual)
|
|
entry: bash -c 'docker run --rm -i hadolint/hadolint < Dockerfile'
|
|
language: system
|
|
files: 'Dockerfile'
|
|
pass_filenames: false
|
|
stages: [manual] # Only runs when explicitly called
|
|
- id: frontend-type-check
|
|
name: Frontend TypeScript Check
|
|
entry: bash -c 'cd frontend && npm run type-check'
|
|
language: system
|
|
files: '^frontend/.*\.(ts|tsx)$'
|
|
pass_filenames: false
|
|
- id: frontend-lint
|
|
name: Frontend Lint (Fix)
|
|
entry: bash -c 'cd frontend && npm run lint -- --fix'
|
|
language: system
|
|
files: '^frontend/.*\.(ts|tsx|js|jsx)$'
|
|
pass_filenames: false
|
|
|
|
- id: frontend-test-coverage
|
|
name: Frontend Test Coverage (Manual)
|
|
entry: scripts/frontend-test-coverage.sh
|
|
language: script
|
|
files: '^frontend/.*\\.(ts|tsx|js|jsx)$'
|
|
pass_filenames: false
|
|
verbose: true
|
|
stages: [manual]
|
|
|
|
- id: security-scan
|
|
name: Security Vulnerability Scan (Manual)
|
|
entry: scripts/security-scan.sh
|
|
language: script
|
|
files: '(\.go$|go\.mod$|go\.sum$)'
|
|
pass_filenames: false
|
|
verbose: true
|
|
stages: [manual] # Only runs when explicitly called
|