Skip to content

Commit 09ae09b

Browse files
committed
chore: add Go Report Card badge and security scanning
- Add Go Report Card badge to README - Add security scanning to Makefile - Add security scanning to CI workflow - Enhance pre-commit hooks with security checks
1 parent 0cd90f8 commit 09ae09b

4 files changed

Lines changed: 34 additions & 12 deletions

File tree

.githooks/pre-commit

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,34 @@ cd "$repo_root"
66

77
export PATH="$(go env GOPATH)/bin:$PATH"
88

9-
echo "Running format checks..."
9+
echo "Running pre-commit checks..."
10+
11+
# Run format checks
12+
echo " → Running format checks..."
1013
make format
1114
if ! git diff --quiet; then
12-
echo "Formatting changed files. Please review and re-stage:"
15+
echo "Error: Formatting changed files. Please review and re-stage:"
1316
git --no-pager diff --name-only
1417
exit 1
1518
fi
1619

17-
echo "Running lint checks..."
20+
# Run lint checks
21+
echo " → Running lint checks..."
1822
make lint
1923

20-
echo "Running short test suite..."
21-
go test -short ./...
24+
# Run security scan
25+
echo " → Running security scan..."
26+
if ! make security; then
27+
echo "Error: Security scan failed. Fix security issues before committing."
28+
exit 1
29+
fi
30+
31+
# Run tests
32+
echo " → Running short test suite..."
33+
if ! go test -short ./...; then
34+
echo "Error: Tests failed."
35+
exit 1
36+
fi
37+
38+
echo "All checks passed!"
39+
exit 0

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,6 @@ jobs:
176176
security:
177177
name: Security Scan
178178
runs-on: ubuntu-latest
179-
needs: test
180179

181180
steps:
182181
- name: Checkout code
@@ -195,8 +194,5 @@ jobs:
195194
go-version: '1.24.x'
196195
cache: true
197196

198-
- name: Run govulncheck
199-
continue-on-error: true
200-
run: |
201-
go install golang.org/x/vuln/cmd/govulncheck@latest
202-
govulncheck ./...
197+
- name: Run security scan
198+
run: make security

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: all build build-pure clean test test-pure bench fmt vet lint security checksums version c-lib deps format install-hooks setup
1+
.PHONY: all build build-pure clean test test-pure bench fmt vet lint security checksums version c-lib deps format install-hooks setup check
22

33
# Build settings
44
BINARY_NAME=cimis
@@ -95,10 +95,16 @@ checksums:
9595
version: build
9696
@./$(BUILD_DIR)/$(BINARY_NAME) version
9797

98+
# Run all checks (format, vet, lint, test)
99+
.PHONY: check
100+
check: format vet lint test
101+
98102
# Download dependencies
103+
.PHONY: deps
99104
deps:
100105
$(GO) mod download
101106
$(GO) mod tidy
107+
$(GO) mod verify
102108

103109
# Format code (alias for existing fmt)
104110
format: fmt

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# CIMIS CLI Tool
22

3+
[![Go Report Card](https://goreportcard.com/badge/github.com/dl-alexandre/cimis-cli)](https://goreportcard.com/report/github.com/dl-alexandre/cimis-cli)
4+
35
A command-line tool for fetching, storing, and querying California Irrigation Management Information System (CIMIS) weather data.
46

57
Built on top of the [cimis-tsdb](https://github.com/dl-alexandre/cimis-tsdb) high-performance time-series storage library.

0 commit comments

Comments
 (0)