Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1a36380
feat(authorizetypes): add authorization status and related types for …
aasanchez Sep 19, 2025
54105e7
chore(docs): update AGENTS.md to clarify third-party library usage an…
aasanchez Oct 9, 2025
67cb94e
refactor(tests): simplify idtoken tests by removing unnecessary strin…
aasanchez Oct 9, 2025
e378c62
test(authorize): refactor idtoken tests to improve error messaging an…
aasanchez Oct 9, 2025
576d751
test(tests): add parallel execution to TestIdToken and update error m…
aasanchez Oct 9, 2025
23cdd11
test(idtoken_test.go): add unit test for IdToken construction and acc…
aasanchez Oct 9, 2025
f74cdb4
chore: update Go version in CI workflows and remove deprecated linter…
aasanchez Oct 9, 2025
6fc646d
chore(build): update golangci-lint version from v2.1 to v2.5 for impr…
aasanchez Oct 9, 2025
de31e23
chore(build): update golangci-lint action version to v8 for consisten…
aasanchez Oct 9, 2025
517f8de
chore(README): remove unnecessary horizontal rule and empty line for …
aasanchez Oct 9, 2025
02606c9
chore(build.yml): update SonarQube scan action from v5 to v6 for impr…
aasanchez Oct 9, 2025
f54c64f
chore(build): update setup-go action from v5 to v6 for improved funct…
aasanchez Oct 9, 2025
827e3e2
chore: clean up comments in build.yml and improve error messages in c…
aasanchez Oct 9, 2025
a0b8727
fix(ciString_test.go): update error messages to use constants for con…
aasanchez Oct 9, 2025
cf00ca8
refactor(tests): replace error messages with constants for consistenc…
aasanchez Oct 9, 2025
b8fe340
style(tests): format error messages in test cases for consistency and…
aasanchez Oct 9, 2025
b766fd8
fix(example_integer_test.go): update error handling to use formatted …
aasanchez Oct 9, 2025
5852006
feat(sonar-project): add govet report path to enhance code quality ch…
aasanchez Oct 10, 2025
bc8bfb2
docs(integer.go): add documentation comments for Integer type and its…
aasanchez Oct 10, 2025
ea675a8
docs(integer.go): enhance documentation for Integer type and its meth…
aasanchez Oct 10, 2025
c9e53af
docs(example_integer_test.go): add examples and guidance for using Se…
aasanchez Oct 10, 2025
cee1331
docs(example_datetime_test.go): add examples for timestamp parsing, t…
aasanchez Oct 10, 2025
b5c24a6
chore(build.yml): add command to display go vet report in the build w…
aasanchez Oct 10, 2025
ef9bfc5
docs(example_cistring_test.go): add detailed examples and context for…
aasanchez Oct 10, 2025
32808ae
docs(errors.go): add comprehensive documentation for error formats an…
aasanchez Oct 10, 2025
8f9be7b
docs(types): add comprehensive documentation for CiString and DateTim…
aasanchez Oct 10, 2025
5f4b172
docs(ciString): enhance documentation for CiString types to clarify u…
aasanchez Oct 10, 2025
6dba823
docs(ciString_test.go): add comments to clarify test cases for empty …
aasanchez Oct 10, 2025
409ba8a
test: change fatal errors to error logs in tests for better test repo…
aasanchez Oct 10, 2025
4620c55
docs(tests): enhance comments in datetime and ciString tests for clar…
aasanchez Oct 10, 2025
67db8d7
docs(ciString_test.go): add comments to clarify OCPP 1.6 CiString ext…
aasanchez Oct 10, 2025
a42fb13
chore: update .editorconfig to set indent size to 2 and enhance integ…
aasanchez Oct 10, 2025
9b52adb
test(race tests): enhance race tests for CiString and DateTime with d…
aasanchez Oct 10, 2025
a5300cf
test(fuzz): enhance fuzz tests for SetInteger to validate uint16 limi…
aasanchez Oct 10, 2025
9140295
docs(AGENTS.md): add documentation guidelines for Go files to ensure …
aasanchez Oct 10, 2025
8642280
docs(benchmark): add OCPP 1.6 pkgsite docs to DateTime/Integer/CiStri…
aasanchez Oct 10, 2025
88b7f19
docs(shared/types): add pkgsite package docs covering DateTime, Integ…
aasanchez Oct 10, 2025
f545fd7
feat(idtoken): update IdToken validation and tests to ensure non-empt…
aasanchez Oct 12, 2025
fe08972
test(idtoken_test.go): update invalid and empty ID token tests to cor…
aasanchez Oct 12, 2025
7e5386f
feat(authorize): add request and response handling for authorization …
aasanchez Oct 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ root = true
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 2
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120

# Go files follow gofmt conventions: tabs, no trailing whitespace, LF endings
[*.go]
indent_style = tab
tab_width = 2
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [1.24.7, 1.25.1]
go: [1.24.7, 1.25.2]

steps:
- uses: actions/checkout@v4
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build

on:
push: # any branch
pull_request: # selected PR events
push:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

concurrency:
Expand All @@ -20,11 +20,11 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ${{ fromJSON( (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && '["1.24.7","1.25.1"]' || '["1.25.1"]' ) }}
go: ${{ fromJSON( (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && '["1.24.7","1.25.2"]' || '["1.25.2"]' ) }}
steps:
- uses: actions/checkout@v5

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
cache: false
Expand Down Expand Up @@ -57,15 +57,15 @@ jobs:
steps:
- uses: actions/checkout@v5

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: 1.25
go-version: 1.25.2
cache: false

- name: golangci-lint
uses: golangci/golangci-lint-action@v8.0.0
uses: golangci/golangci-lint-action@v8
with:
version: v2.1
version: v2.5
args: --config golangci.yml --timeout=5m ./...

- name: Report
Expand All @@ -84,9 +84,9 @@ jobs:
steps:
- uses: actions/checkout@v5

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: 1.25.1
go-version: 1.25.2
cache: false

- run: mkdir -p reports
Expand All @@ -109,18 +109,21 @@ jobs:
strategy:
fail-fast: false
matrix:
go: ${{ fromJSON( (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && '["1.24.7","1.25.1"]' || '["1.25.1"]' ) }}
go: ${{ fromJSON( (github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')) && '["1.24.7","1.25.2"]' || '["1.25.2"]' ) }}
steps:
- uses: actions/checkout@v5

- uses: actions/setup-go@v5
- uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}
cache: false

- run: mkdir -p reports

- run: go vet ./... >reports/vet

- run: cat reports/vet

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
Expand All @@ -139,7 +142,7 @@ jobs:
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Download All Artifacts
uses: actions/download-artifact@v5
Expand All @@ -148,6 +151,6 @@ jobs:
merge-multiple: true

- name: SonarQube Scan
uses: SonarSource/sonarqube-scan-action@v5
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
91 changes: 52 additions & 39 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,55 @@
- Tools used by Makefile: golangci-lint, staticcheck, ripgrep (rg), gci, gofumpt, golines, pkgsite, sonar-scanner
(optional)

## Build & Modules

- go mod tidy — ensure deps are tidy
- Library package; no binary build target

## Test

- All tests with coverage: make test (artifacts in reports/)
- Open HTML coverage: make test-coverage
- Run a single package: go test -v ./shared/types
- Run a single test: go test -v ./shared/types -run '^TestDateTime$'
- Run example tests: make test-example (or: go test -run '^Example' ./...)
- Benchmarks: make test-benchmark (or: go test -tags=benchmark -bench=. -benchmem ./...)
- Run a single benchmark: go test -run '^$' -bench '^BenchmarkInteger$' ./shared/types/benchmark

## Lint, Vet, Format

- Lint suite: make lint (golangci-lint, go vet → reports/govet.json, staticcheck → reports/staticcheck)
- Format: make format (gci write; gofumpt; golines; gofmt) — run before committing

## Code Style Guidelines

- Imports: managed by gci; group stdlib, module (github.com/aasanchez/ocpp16messages), then others; no unused imports
- Formatting: gofumpt + golines; keep lines concise; run make format to enforce
- Types: prefer precise types in shared/types; time parsing/formatting uses RFC3339/RFC3339Nano (see DateTime)
- Naming: exported identifiers use PascalCase; keep acronyms like ID in caps (revive var-naming allows ID)
- Errors: do not panic in library code; wrap with fmt.Errorf("context: %w", err); provide actionable messages
- Validation: keep constructors/setters returning (T, error) for validation (e.g., SetDateTime)
- Testing: table-driven tests where applicable; example_*.go for documentation tests; keep -race compatible when adding
tests

## CI & Quality

- Coverage report: reports/coverage.out (go tool cover -func)
- Sonar/quality gate (optional): make sonar after test & lint

## Cursor/Copilot Rules

- No Cursor or Copilot rule files found; nothing to import at this time
## Coding Style

- Never add external third party libraries or package, we must use ONLY and exclusively the golang standard library
- All type of tests, which can be unitest, fuzzy test, benchmark, or even race test, must be very atomic, targeting
individual cases, very atomic and simple.
- Leverage and exten [shared/types/errors.go](shared/types/errors.go) to consolidate the message errors
- No string should be longer than 40 charecters, no mather the reason.

## Agent: Go Documentation Optimizer

### Purpose

Whenever I ask to “improve the documentation for a file,” this agent should automatically apply the following
instructions. The goal is to ensure all Go files in the project have **pkgsite-ready documentation** with domain context (OCPP 1.6), making them clear, professional, and highly usable.

Always write the file, if is possible

### Universal Rules for Documentation

- Always generate **pkgsite-style GoDoc comments** (top of file, package, and functions).
- 80 columns limit of leght of the line
- Documentation must be:
- Highly detailed
- Precise and professional
- Clear and idiomatic Go style
- Always frame explanations in the context of **OCPP 1.6** (Open Charge Point Protocol v1.6).
- Explain why this type/test/function matters in OCPP.
- Highlight robustness, validation, and prevention of malformed/malicious input.
- Reference real OCPP 1.6 domains (transaction IDs, connector IDs, meter values, authorization IDs, etc.).
- Include at least three levels of comments:
- Package-level comment — What this package/file is about and its role in OCPP.
- Type/function-level comments — What it does, valid/invalid behavior, expected usage.
- Contextual notes — Why this matters for OCPP 1.6 reliability, safety, and compliance.
- Output should be ready to copy into the source file without extra formatting.
- Do not just describe what the code does — connect it to why it matters in OCPP 1.6.

### Prompt Template (auto-applied)

```text
Please improve and optimize the Go documentation for this file.
Follow the **Universal Rules for Documentation** in Agents.md.

**File:** <replace-with-path>
```

### Usage Notes

- When I say:
> “Improve the documentation for @shared/types/fuzz/datetime_fuzz_test.go”
> The agent should automatically apply the rules above without me restating them.
- Works for any file path.
- Output must be directly usable in pkgsite.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=aasanchez_ocpp16_messages&metric=coverage)](https://sonarcloud.io/summary/new_code?id=aasanchez_ocpp16_messages)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=aasanchez_ocpp16_messages&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=aasanchez_ocpp16_messages)

---

## Overview

This project provides a robust, modular, and thoroughly tested implementation of OCPP 1.6 message types and payload validation for Go. It is designed for high-quality message serialization, strict type safety, and OCPP-compliant EV charging station management.
Expand Down
14 changes: 10 additions & 4 deletions golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ formatters:
- gofumpt
- goimports
- golines
# - swaggo
linters:
default: all
disable:
- godot
- lll
- mnd
- testpackage
- varnamelen
- wsl
settings:
wsl_v5:
allow-first-in-block: true
allow-whole-block: false
branch-max-lines: 2
lll:
line-length: 80
revive:
enable-all-rules: true
rules:
Expand All @@ -26,7 +30,7 @@ linters:
arguments:
- ["ID"]
- name: line-length-limit
disabled: true
arguments: [80]
- name: add-constant
disabled: true
- name: exported
Expand All @@ -35,6 +39,8 @@ linters:
disabled: true
- name: cognitive-complexity
arguments: [15]
- name: package-directory-mismatch
disabled: true
depguard:
rules:
main:
Expand Down
1 change: 1 addition & 0 deletions messages/authorize/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package authorize
Loading
Loading