Skip to content

chore: Fix Go Report Card issues - #55

Merged
lykinsbd merged 6 commits into
masterfrom
chore/54-goreportcard-fixes
Feb 26, 2026
Merged

chore: Fix Go Report Card issues#55
lykinsbd merged 6 commits into
masterfrom
chore/54-goreportcard-fixes

Conversation

@lykinsbd

Copy link
Copy Markdown
Collaborator

Summary

Addresses all findings from Go Report Card (#54).

Changes

  • gofmt: Format ciscohandlers_test.go, sshlistners_test.go, cmdmatch.go
  • gocyclo: Refactor GenericCiscoHandler — extract handleShellInput and dispatchCommand helpers, reducing complexity from 22 → 11/8 (both under threshold of 15)
  • CI: Add golangci-lint-action to test.yml with .golangci.yml config (gofmt, govet, misspell, gocyclo, ineffassign, staticcheck)

Coverage

93.6% (up from 93.0% — refactoring improved testability of dispatch logic)

Closes #54

- Apply gofmt formatting to ciscohandlers_test.go, sshlistners_test.go,
  and cmdmatch.go
- Refactor GenericCiscoHandler: extract handleShellInput and
  dispatchCommand helpers, reducing cyclomatic complexity from 22 to <15
- Add golangci-lint to CI workflow with .golangci.yml config

Closes #54
- gofmt: format dispatchCommand function
- misspell: fix 'Listners' -> 'Listeners' in package comment
- staticcheck SA9003: remove empty branch in test server goroutine
@github-actions

Copy link
Copy Markdown
Contributor

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/tbotnz/cisshgo/ssh_server/handlers 94.03% (+0.38%) 👍
github.com/tbotnz/cisshgo/ssh_server/sshlistners 100.00% (ø)
github.com/tbotnz/cisshgo/utils 100.00% (ø)

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/tbotnz/cisshgo/ssh_server/handlers/ciscohandlers.go 94.03% (+0.38%) 67 (+4) 63 (+4) 4 👍
github.com/tbotnz/cisshgo/ssh_server/sshlistners/sshlistners.go 100.00% (ø) 7 7 0
github.com/tbotnz/cisshgo/utils/cmdmatch.go 100.00% (ø) 36 36 0

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/tbotnz/cisshgo/ssh_server/handlers/ciscohandlers_test.go
  • github.com/tbotnz/cisshgo/ssh_server/sshlistners/sshlistners_test.go

@lykinsbd
lykinsbd merged commit 576dad4 into master Feb 26, 2026
4 checks passed
@lykinsbd
lykinsbd deleted the chore/54-goreportcard-fixes branch February 26, 2026 22:09
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.

chore: Fix Go Report Card issues (gofmt, golint, gocyclo)

1 participant