Skip to content

Commit 49d8625

Browse files
authored
Merge pull request #1 from codeforgood-org/claude/reorganize-enhance-repo-011CV6Hj61MC6L3rRRKQ1Sag
Enhance repo and code organization
2 parents 420c8c9 + 6d689c4 commit 49d8625

File tree

21 files changed

+2229
-103
lines changed

21 files changed

+2229
-103
lines changed

.dockerignore

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Git
2+
.git
3+
.gitignore
4+
5+
# Documentation
6+
*.md
7+
!README.md
8+
LICENSE
9+
10+
# IDE
11+
.vscode
12+
.idea
13+
*.swp
14+
*.swo
15+
*~
16+
17+
# Build artifacts
18+
expense-tracker
19+
*.test
20+
*.out
21+
coverage.out
22+
coverage.html
23+
24+
# Data
25+
expenses.json
26+
data/
27+
*.csv
28+
29+
# OS
30+
.DS_Store
31+
Thumbs.db
32+
33+
# CI/CD
34+
.github
35+
36+
# Docker
37+
Dockerfile
38+
docker-compose.yml
39+
.dockerignore

.github/workflows/ci.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
go-version: ['1.21', '1.22', '1.23']
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
26+
- name: Verify dependencies
27+
run: go mod verify
28+
29+
- name: Build
30+
run: go build -v ./cmd/expense-tracker
31+
32+
- name: Run tests
33+
run: go test -v -race -coverprofile=coverage.out ./...
34+
35+
- name: Upload coverage to Codecov
36+
if: matrix.go-version == '1.23'
37+
uses: codecov/codecov-action@v3
38+
with:
39+
file: ./coverage.out
40+
flags: unittests
41+
name: codecov-umbrella
42+
43+
lint:
44+
name: Lint
45+
runs-on: ubuntu-latest
46+
steps:
47+
- name: Checkout code
48+
uses: actions/checkout@v4
49+
50+
- name: Set up Go
51+
uses: actions/setup-go@v5
52+
with:
53+
go-version: '1.23'
54+
55+
- name: Run golangci-lint
56+
uses: golangci/golangci-lint-action@v3
57+
with:
58+
version: latest
59+
60+
security:
61+
name: Security Scan
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
67+
- name: Run Gosec Security Scanner
68+
uses: securego/gosec@master
69+
with:
70+
args: './...'

.gitignore

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# If you prefer the allow list template instead of the deny list, see community template:
22
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3-
#
3+
44
# Binaries for programs and plugins
55
*.exe
66
*.exe~
77
*.dll
88
*.so
99
*.dylib
10+
expense-tracker
1011

1112
# Test binary, built with `go test -c`
1213
*.test
1314

1415
# Output of the go coverage tool, specifically when used with LiteIDE
1516
*.out
17+
coverage.out
18+
coverage.html
1619

1720
# Dependency directories (remove the comment below to include it)
1821
# vendor/
@@ -23,3 +26,19 @@ go.work.sum
2326

2427
# env file
2528
.env
29+
30+
# Application data
31+
expenses.json
32+
*.csv
33+
data/
34+
35+
# IDE specific files
36+
.vscode/
37+
.idea/
38+
*.swp
39+
*.swo
40+
*~
41+
42+
# OS specific files
43+
.DS_Store
44+
Thumbs.db

.golangci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
modules-download-mode: readonly
5+
6+
linters:
7+
enable:
8+
- errcheck # Check for unchecked errors
9+
- gosimple # Simplify code
10+
- govet # Vet examines Go source code
11+
- ineffassign # Detect ineffectual assignments
12+
- staticcheck # Staticcheck is a go vet on steroids
13+
- unused # Check for unused constants, variables, functions and types
14+
- gofmt # Check whether code was gofmt-ed
15+
- goimports # Check import statements are formatted
16+
- misspell # Finds commonly misspelled English words
17+
- unconvert # Remove unnecessary type conversions
18+
- unparam # Find unused function parameters
19+
- gosec # Security problems
20+
- gocritic # The most opinionated Go source code linter
21+
- revive # Fast, configurable, extensible, flexible, and beautiful linter for Go
22+
- stylecheck # Stylecheck is a replacement for golint
23+
- gocyclo # Computes and checks cyclomatic complexity
24+
- dupl # Tool for code clone detection
25+
- funlen # Tool for detection of long functions
26+
- gocognit # Computes and checks cognitive complexity
27+
- nestif # Reports deeply nested if statements
28+
- goconst # Finds repeated strings that could be replaced by a constant
29+
- godot # Check if comments end in a period
30+
- errorlint # Find code that will cause problems with Go 1.13 error wrapping
31+
- whitespace # Detection of leading and trailing whitespace
32+
33+
linters-settings:
34+
errcheck:
35+
check-type-assertions: true
36+
check-blank: true
37+
38+
govet:
39+
check-shadowing: true
40+
enable-all: true
41+
42+
gocyclo:
43+
min-complexity: 15
44+
45+
funlen:
46+
lines: 100
47+
statements: 50
48+
49+
gocognit:
50+
min-complexity: 20
51+
52+
nestif:
53+
min-complexity: 4
54+
55+
goconst:
56+
min-len: 3
57+
min-occurrences: 3
58+
59+
misspell:
60+
locale: US
61+
62+
godot:
63+
scope: declarations
64+
capital: true
65+
66+
revive:
67+
confidence: 0.8
68+
rules:
69+
- name: blank-imports
70+
- name: context-as-argument
71+
- name: dot-imports
72+
- name: error-return
73+
- name: error-strings
74+
- name: error-naming
75+
- name: exported
76+
- name: if-return
77+
- name: increment-decrement
78+
- name: var-naming
79+
- name: package-comments
80+
- name: range
81+
- name: receiver-naming
82+
- name: indent-error-flow
83+
- name: superfluous-else
84+
- name: unreachable-code
85+
86+
issues:
87+
exclude-use-default: false
88+
max-issues-per-linter: 0
89+
max-same-issues: 0
90+
91+
exclude-rules:
92+
# Exclude some linters from running on tests files
93+
- path: _test\.go
94+
linters:
95+
- gocyclo
96+
- errcheck
97+
- dupl
98+
- gosec
99+
- funlen
100+
- gocognit
101+
102+
# Allow main and init functions to be longer
103+
- path: cmd/
104+
linters:
105+
- funlen
106+
- gocyclo
107+
108+
output:
109+
format: colored-line-number
110+
print-issued-lines: true
111+
print-linter-name: true
112+
sort-results: true

CHANGELOG.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - 2025-11-13
9+
10+
### Added
11+
- Initial release with complete project reorganization
12+
- Standard Go project structure (cmd/, internal/, pkg/)
13+
- Comprehensive test suite with full coverage
14+
- Unique ID generation for all expenses
15+
- Expense model with validation
16+
- Thread-safe JSON storage with mutex locks
17+
- CLI commands:
18+
- `add` - Add new expenses with optional descriptions
19+
- `list` - List all expenses sorted by date
20+
- `delete` - Remove expenses by ID
21+
- `summary` - View category-based summary with percentages
22+
- `categories` - List all unique categories
23+
- `filter` - Filter expenses by category
24+
- `range` - Filter expenses by date range
25+
- `export` - Export expenses to CSV format
26+
- `help` - Display help information
27+
- `version` - Show version information
28+
- Command aliases (del/rm for delete, sum for summary, cats for categories)
29+
- Professional documentation:
30+
- Comprehensive README with examples
31+
- CONTRIBUTING.md with development guidelines
32+
- CODE_OF_CONDUCT.md for community standards
33+
- Inline code documentation
34+
- Build and development tools:
35+
- Makefile with build, test, lint, coverage targets
36+
- GitHub Actions CI/CD workflow
37+
- Multi-version Go testing (1.21, 1.22, 1.23)
38+
- golangci-lint integration
39+
- Security scanning with gosec
40+
- Docker support for containerized deployment
41+
- Enhanced .gitignore with comprehensive exclusions
42+
43+
### Changed
44+
- Migrated from single file to modular architecture
45+
- Replaced deprecated `ioutil` with `os` package
46+
- Improved error handling and validation
47+
- Better separation of concerns
48+
49+
### Breaking Changes
50+
- Complete project restructuring requires rebuild
51+
- Data format remains compatible (JSON)
52+
- Binary location changed from root to `./expense-tracker`
53+
54+
## [0.1.0] - 2025-11-13
55+
56+
### Added
57+
- Initial monolithic implementation
58+
- Basic add and list commands
59+
- JSON file storage
60+
- Simple CLI interface
61+
62+
---
63+
64+
## Versioning Guide
65+
66+
- **MAJOR** version for incompatible API changes
67+
- **MINOR** version for added functionality in a backward compatible manner
68+
- **PATCH** version for backward compatible bug fixes
69+
70+
## Links
71+
- [GitHub Repository](https://github.com/codeforgood-org/go-expense-tracker)
72+
- [Issue Tracker](https://github.com/codeforgood-org/go-expense-tracker/issues)

0 commit comments

Comments
 (0)