Refactor documentation for clarity and consistency, update test function naming convention
This commit is contained in:
parent
2ec2fcd2ab
commit
6236717fdb
46
AGENTS.md
46
AGENTS.md
|
|
@ -1,14 +1,20 @@
|
||||||
# AGENTS.md
|
# AGENTS.md
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
This file defines the default working agreement for AI coding agents and contributors in this repository.
|
|
||||||
|
This file defines the default working agreement for AI coding agents
|
||||||
|
and contributors in this repository.
|
||||||
|
|
||||||
## Documentation Language
|
## Documentation Language
|
||||||
Project language is English. All documentation, issues, pull requests, commit messages, and code comments should be written in English.
|
|
||||||
|
Project language is English. All documentation, issues, pull requests,
|
||||||
|
commit messages, and code comments should be written in English.
|
||||||
All newly created documentation in this project must be written in English.
|
All newly created documentation in this project must be written in English.
|
||||||
All project documentation files must be stored under `docs/`, except `README.md` and `AGENTS.md`.
|
All project documentation files must be stored under `docs/`,
|
||||||
|
except `README.md` and `AGENTS.md`.
|
||||||
|
|
||||||
## Working Principles
|
## Working Principles
|
||||||
|
|
||||||
1. Keep changes minimal and focused on the requested task.
|
1. Keep changes minimal and focused on the requested task.
|
||||||
2. Preserve existing public APIs unless a breaking change is explicitly requested.
|
2. Preserve existing public APIs unless a breaking change is explicitly requested.
|
||||||
3. Prefer clear, maintainable code over clever shortcuts.
|
3. Prefer clear, maintainable code over clever shortcuts.
|
||||||
|
|
@ -16,22 +22,29 @@ All project documentation files must be stored under `docs/`, except `README.md`
|
||||||
5. Never add secrets, credentials, or tokens to the repository.
|
5. Never add secrets, credentials, or tokens to the repository.
|
||||||
|
|
||||||
## Testing Expectations
|
## Testing Expectations
|
||||||
1. Add or update tests for behavior changes.
|
|
||||||
|
1. Add or update tests for behaviour changes.
|
||||||
2. Keep tests deterministic and fast.
|
2. Keep tests deterministic and fast.
|
||||||
3. Prefer table-driven tests where they improve readability.
|
3. Prefer table-driven tests where they improve readability.
|
||||||
4. Run relevant tests locally before finishing changes.
|
4. Run relevant tests locally before finishing changes.
|
||||||
5. For Go projects, use `github.com/smartystreets/goconvey` as the standard test library.
|
5. For Go projects, use `github.com/smartystreets/goconvey`
|
||||||
|
as the standard test library.
|
||||||
|
|
||||||
## Build Artifacts and Reports
|
## Build Artifacts and Reports
|
||||||
|
|
||||||
1. Builder logs and generated reports must be created under `.build/`.
|
1. Builder logs and generated reports must be created under `.build/`.
|
||||||
2. The `.build/` directory must be excluded from version control via `.gitignore`.
|
2. The `.build/` directory must be excluded from version control via `.gitignore`.
|
||||||
|
|
||||||
## Git and Script Standards
|
## Git and Script Standards
|
||||||
|
|
||||||
1. Shell scripts (`*.sh`) must use LF line endings.
|
1. Shell scripts (`*.sh`) must use LF line endings.
|
||||||
2. Shell scripts committed to the repository must be executable in Git index (mode `100755`).
|
2. Shell scripts committed to the repository must be executable
|
||||||
3. When adding a new shell script, set execute permissions before commit: `git add --chmod=+x path/to/script.sh`.
|
in Git index (mode `100755`).
|
||||||
|
3. When adding a new shell script, set execute permissions before commit:
|
||||||
|
`git add --chmod=+x path/to/script.sh`.
|
||||||
|
|
||||||
## Git Bash Execution Defaults
|
## Git Bash Execution Defaults
|
||||||
|
|
||||||
1. Repository maintenance scripts are executed with Git Bash shell on Windows.
|
1. Repository maintenance scripts are executed with Git Bash shell on Windows.
|
||||||
2. Default repository root is `~/git`.
|
2. Default repository root is `~/git`.
|
||||||
3. The repository root can be overridden via `GO_GIT_ROOT`.
|
3. The repository root can be overridden via `GO_GIT_ROOT`.
|
||||||
|
|
@ -40,11 +53,15 @@ All project documentation files must be stored under `docs/`, except `README.md`
|
||||||
|
|
||||||
## Definition of Done (DoD)
|
## Definition of Done (DoD)
|
||||||
|
|
||||||
### Purpose
|
### DoD Purpose
|
||||||
The Definition of Done defines the minimum quality bar for every completed change in this repository.
|
|
||||||
|
The Definition of Done defines the minimum quality bar
|
||||||
|
for every completed change in this repository.
|
||||||
|
|
||||||
### Mandatory Criteria
|
### Mandatory Criteria
|
||||||
|
|
||||||
1. Tests
|
1. Tests
|
||||||
|
|
||||||
- Every code change is covered by tests where applicable.
|
- Every code change is covered by tests where applicable.
|
||||||
- New functionality includes new tests.
|
- New functionality includes new tests.
|
||||||
- Bug fixes include at least one regression test.
|
- Bug fixes include at least one regression test.
|
||||||
|
|
@ -52,31 +69,40 @@ The Definition of Done defines the minimum quality bar for every completed chang
|
||||||
- Automated test coverage is at least 80%.
|
- Automated test coverage is at least 80%.
|
||||||
|
|
||||||
1. Functional documentation
|
1. Functional documentation
|
||||||
|
|
||||||
- Implemented functionality is documented.
|
- Implemented functionality is documented.
|
||||||
- Public API-relevant changes are reflected in README and/or docs.
|
- Public API-relevant changes are reflected in README and/or docs.
|
||||||
|
|
||||||
1. Documentation standards
|
1. Documentation standards
|
||||||
|
|
||||||
- Documentation is written in English.
|
- Documentation is written in English.
|
||||||
- Documentation files are placed under `docs/`.
|
- Documentation files are placed under `docs/`.
|
||||||
- Exceptions: `README.md` and `AGENTS.md` remain at repository root.
|
- Exceptions: `README.md` and `AGENTS.md` remain at repository root.
|
||||||
|
|
||||||
### Technical Completion Criteria
|
### Technical Completion Criteria
|
||||||
|
|
||||||
1. Build and test status
|
1. Build and test status
|
||||||
|
|
||||||
- The project builds successfully.
|
- The project builds successfully.
|
||||||
- Relevant test commands run successfully.
|
- Relevant test commands run successfully.
|
||||||
|
|
||||||
1. No unresolved critical issues
|
1. No unresolved critical issues
|
||||||
|
|
||||||
- No new blocking errors are introduced.
|
- No new blocking errors are introduced.
|
||||||
- Known non-blocking warnings are acceptable only if unrelated to the change or documented.
|
- Known non-blocking warnings are acceptable only if unrelated
|
||||||
|
to the change or documented.
|
||||||
|
|
||||||
1. SonarQube status
|
1. SonarQube status
|
||||||
|
|
||||||
- No SonarQube errors are present.
|
- No SonarQube errors are present.
|
||||||
|
|
||||||
1. Documentation structure
|
1. Documentation structure
|
||||||
|
|
||||||
- Links to moved or newly added docs are valid.
|
- Links to moved or newly added docs are valid.
|
||||||
- Documentation structure remains consistent with project rules.
|
- Documentation structure remains consistent with project rules.
|
||||||
|
|
||||||
### Review Checklist (Quick)
|
### Review Checklist (Quick)
|
||||||
|
|
||||||
- [ ] Change is implemented and meets acceptance criteria.
|
- [ ] Change is implemented and meets acceptance criteria.
|
||||||
- [ ] Tests were added/updated and pass.
|
- [ ] Tests were added/updated and pass.
|
||||||
- [ ] Go tests use `github.com/smartystreets/goconvey`.
|
- [ ] Go tests use `github.com/smartystreets/goconvey`.
|
||||||
|
|
|
||||||
20
README.md
20
README.md
|
|
@ -1,7 +1,7 @@
|
||||||
<div style="text-align:left"><img src="https://www.yoorie.de/img/favicon_32.png"/></div>
|
|
||||||
|
|
||||||
# Go utility library
|
# Go utility library
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
[](https://drone.yoorie.de/go-lib/util)
|
[](https://drone.yoorie.de/go-lib/util)
|
||||||
|
|
||||||
## Project Description
|
## Project Description
|
||||||
|
|
@ -41,22 +41,20 @@ go get scm.yoorie.de/go-lib/util
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"scm.yoorie.de/go-lib/util"
|
"scm.yoorie.de/go-lib/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if util.FileExists("config.yaml") {
|
if util.FileExists("config.yaml") {
|
||||||
fmt.Println("config file found")
|
fmt.Println("config file found")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println(util.JoiningSlash("/api", "v1", "users"))
|
fmt.Println(util.JoiningSlash("/api", "v1", "users"))
|
||||||
fmt.Println(util.GetGlobalConfigurationFile("myapp", "config.yaml"))
|
fmt.Println(util.GetGlobalConfigurationFile("myapp", "config.yaml"))
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
Copyright © 2023 yoorie.de
|
Copyright © 2023 yoorie.de
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,13 @@
|
||||||
|
|
||||||
## Purpose
|
## Purpose
|
||||||
|
|
||||||
This Definition of Done defines the minimum quality bar for every completed change in this repository.
|
This Definition of Done defines the minimum quality bar
|
||||||
|
for every completed change in this repository.
|
||||||
|
|
||||||
## Mandatory Criteria
|
## Mandatory Criteria
|
||||||
|
|
||||||
1. Tests
|
1. Tests
|
||||||
|
|
||||||
- Every code change is covered by tests where applicable.
|
- Every code change is covered by tests where applicable.
|
||||||
- New functionality includes new tests.
|
- New functionality includes new tests.
|
||||||
- Bug fixes include at least one regression test.
|
- Bug fixes include at least one regression test.
|
||||||
|
|
@ -14,10 +16,12 @@ This Definition of Done defines the minimum quality bar for every completed chan
|
||||||
- Automated test coverage is at least 80%.
|
- Automated test coverage is at least 80%.
|
||||||
|
|
||||||
1. Functional documentation
|
1. Functional documentation
|
||||||
|
|
||||||
- Implemented functionality is documented.
|
- Implemented functionality is documented.
|
||||||
- Public API-relevant changes are reflected in README and/or docs.
|
- Public API-relevant changes are reflected in README and/or docs.
|
||||||
|
|
||||||
1. Documentation standards
|
1. Documentation standards
|
||||||
|
|
||||||
- Documentation is written in English.
|
- Documentation is written in English.
|
||||||
- Documentation files are placed under `docs/`.
|
- Documentation files are placed under `docs/`.
|
||||||
- Exceptions: `README.md` and `AGENTS.md` remain at repository root.
|
- Exceptions: `README.md` and `AGENTS.md` remain at repository root.
|
||||||
|
|
@ -25,17 +29,22 @@ This Definition of Done defines the minimum quality bar for every completed chan
|
||||||
## Technical Completion Criteria
|
## Technical Completion Criteria
|
||||||
|
|
||||||
1. Build and test status
|
1. Build and test status
|
||||||
|
|
||||||
- The project builds successfully.
|
- The project builds successfully.
|
||||||
- Relevant test commands run successfully.
|
- Relevant test commands run successfully.
|
||||||
|
|
||||||
1. No unresolved critical issues
|
1. No unresolved critical issues
|
||||||
|
|
||||||
- No new blocking errors are introduced.
|
- No new blocking errors are introduced.
|
||||||
- Known non-blocking warnings are acceptable only if unrelated to the change or documented.
|
- Known non-blocking warnings are acceptable only if unrelated
|
||||||
|
to the change or documented.
|
||||||
|
|
||||||
1. SonarQube status
|
1. SonarQube status
|
||||||
|
|
||||||
- No SonarQube errors are present.
|
- No SonarQube errors are present.
|
||||||
|
|
||||||
1. Documentation links and structure
|
1. Documentation links and structure
|
||||||
|
|
||||||
- Links to moved or newly added docs are valid.
|
- Links to moved or newly added docs are valid.
|
||||||
- Documentation structure remains consistent with project rules.
|
- Documentation structure remains consistent with project rules.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestIsSuperUser_SidAllocationError(t *testing.T) {
|
func TestIsSuperUserSidAllocationError(t *testing.T) {
|
||||||
Convey("IsSuperUser should return false when SID allocation fails", t, func() {
|
Convey("IsSuperUser should return false when SID allocation fails", t, func() {
|
||||||
origAllocate := allocateAdminGroupSid
|
origAllocate := allocateAdminGroupSid
|
||||||
origFatalf := fatalf
|
origFatalf := fatalf
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue