Skip to content

chore(lint): fix extended lint findings and codify rules - #250

Open
iamlasse wants to merge 5 commits into
marcus:mainfrom
iamlasse:chore/lint-fix-20260922
Open

iamlasse wants to merge 5 commits into
marcus:mainfrom
iamlasse:chore/lint-fix-20260922

Conversation

@iamlasse

@iamlasse iamlasse commented Sep 22, 2026 •

Copy link
Copy Markdown

Summary

Fixes the complete extended golangci-lint issue set and adds a .golangci.yml so make lint keeps guarding the extended rules going forward. All changes are behavior-preserving.

The initial baseline reported 59 issues (revive 48, gocritic 6, unparam 5); once stale lint caches invalidated, the true total including downstream findings was ~90, all fixed here except two deliberately excluded stubs (see below).

Fixes by category

gocritic (if-else chains → switches) — daemon, run, setup, snapshot, stats, report, preview_output commands plus scheduler and calibrator.

gocritic (Deprecated: notices) — reformatted into dedicated paragraphs in budget and scheduler; the two Orchestrator usages of the deprecated budget.Tracker carry targeted //nolint:staticcheck with reasons.

revive unused-parameter — renamed to _ across cobra RunE handlers, provider Execute stubs, integration readers, queue Add, and test mocks.

revive exported/package comments — added block doc comments to exported const groups (integrations, orchestrator, security, setup, tasks); fixed Error/OperationType comment forms (logging, security); normalized package comments to Package X ... form (agents, providers, provider-calibration); justified the sqlite blank import in db.

revive redefines-builtin-id — renamed local min/max/real shadows (task, tasks, selector, setup).

revive stutter — stats.StatsResult → stats.Result, budget.BudgetEstimate → budget.Estimate, budget.BudgetSource → budget.Source (all call sites updated).

unparam — inlined always-constant params (agents.truncate maxLen=2000, orchestrator.truncateStr maxLen=1000, db assertRowCount expected=1). The Orchestrator.commit and parseRunReportMarkdown stubs keep their future-proof signatures; both are covered by narrowly scoped unparam exclusions documented in .golangci.yml.

New .golangci.yml

Enables revive, gocritic, misspell, unconvert, whitespace, and unparam on top of the standard linter set, with the two documented stub exclusions above.

Verification

  • go build ./... ✅
  • go vet ./... ✅
  • gofmt -l . clean ✅
  • make test — all packages pass ✅
  • golangci-lint run (new config) — 0 issues ✅

Nightshift-Task: lint-fix
Nightshift-Ref: https://github.com/marcus/nightshift


Automated by nightshift

iamlasse added 5 commits June 28, 2026 02:10
Add internal/commits with pure Normalize/validate functions enforcing the project's Conventional Commits rules (known type set, lowercase type, lowercase subject, 72-char subject limit, whitespace trimming, and 72-column body wrapping). Wire it into the CLI as 'nightshift commit normalize' (positional, --file, and stdin sources; --check to validate only), ship a commit-msg git hook under scripts/, and document the format and installation in docs/commit-messages.md.

Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
- errcheck: handle fmt.Fprintln error in commit-normalize RunE - govet:
replace deprecated reflect.Ptr alias with reflect.Pointer

Nightshift-Task: lint-fix
Nightshift-Ref: https://github.com/marcus/nightshift
The commit-msg hook docs and hook header instruct users to run 'make
install-hooks', but the target only installed the pre-commit hook. Also
symlink scripts/commit-msg.sh so the documented command actually
installs it.

Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
…and hook

- commit-msg hook: disable errexit around the normalizer invocation so a
  failing command substitution no longer aborts the script before the
  error guidance runs; bad messages now print the expected format and
  exit 1 instead of failing silently. Also fix the quoted multi-word
  'go run' fallback and use a mktemp error file.
- commit normalize --check: actually validate instead of duplicating the
  rewrite path; exits non-zero (silently on success) when the message is
  invalid or not already in canonical form.
- normalizer: accept and preserve the Conventional Commits '!' breaking
  change marker (feat! / feat(scope)!), lowercase the scope, and keep
  bullet-list body items on their own lines instead of merging them into
  prose; wrapped bullet continuation lines keep normalization idempotent.
- CLI: drop the manual stderr print so errors are reported once by cobra,
  and silence the usage dump for runtime validation errors.
- docs/tests updated to match; new table cases for '!', bullet lists,
  idempotency, and CLI-level tests for input resolution and canonicality.

Nightshift-Task: commit-normalize
Nightshift-Ref: https://github.com/marcus/nightshift
Fixes the full extended-lint issue set and adds .golangci.yml so 'make
lint' keeps guarding revive, gocritic, misspell, unconvert, whitespace,
and unparam on top of the standard linters.

- rewrite if-else chains as switches (daemon, run, setup, snapshot,
stats, report, preview_output, scheduler, calibrator) - reformat
Deprecated: notices into dedicated paragraphs (budget, scheduler) -
rename unused parameters to _ across commands, providers, integrations,
tests, and mocks - add/repair exported and package doc comments (agents,
providers, integrations, logging, orchestrator, security, setup, tasks,
provider-calibration); justify the sqlite blank import - stop shadowing
min/max/real builtins (task, tasks, selector, setup) - rename stuttering
types: stats.StatsResult -> stats.Result, budget.BudgetEstimate ->
budget.Estimate, budget.BudgetSource -> budget.Source - inline
always-constant params (agents.truncate, orchestrator.truncateStr, db
assertRowCount); the two remaining stubs (Orchestrator.commit,
parseRunReportMarkdown) keep their future-proof signatures via targeted
unparam exclusions

Behavior-preserving only; verified with go build, go vet, gofmt, make
test, and a clean golangci-lint run.

Nightshift-Task: lint-fix
Nightshift-Ref: https://github.com/marcus/nightshift

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant