Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
58 changes: 58 additions & 0 deletions .github/workflows/report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Go Report

# The checks goreportcard.com used to run (gofmt, go vet, staticcheck,
# ineffassign, misspell, gocyclo), run on every push and pull request.

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
report:
name: Report
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Install tools
run: |
go install honnef.co/go/tools/cmd/staticcheck@2024.1.1
go install github.com/gordonklaus/ineffassign@v0.1.0
go install github.com/client9/misspell/cmd/misspell@v0.3.4
go install github.com/fzipp/gocyclo/cmd/gocyclo@v0.6.0

- name: gofmt
run: |
unformatted=$(gofmt -l .)
if [ -n "$unformatted" ]; then
echo "These files need gofmt:"
echo "$unformatted"
exit 1
fi

- name: go vet
run: go vet ./...

- name: staticcheck
run: staticcheck ./...

- name: ineffassign
run: ineffassign ./...

- name: misspell
run: misspell -error $(git ls-files '*.go' '*.md')

- name: gocyclo (functions over 15, informational)
run: gocyclo -over 15 -ignore '_test\.go$' . || true
639 changes: 133 additions & 506 deletions README.md

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion cmd/prw/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ PowerShell:
}
},
}

2 changes: 0 additions & 2 deletions cmd/prw/mcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"io"
"path/filepath"
"strings"
"sync"
"testing"
"time"

Expand All @@ -24,7 +23,6 @@ type mcpHarness struct {
done chan error
cancel context.CancelFunc
pending []map[string]interface{} // messages read while waiting for something else
mu sync.Mutex
}

func startMCP(t *testing.T, factory func(string) (mcpClient, error)) *mcpHarness {
Expand Down
2 changes: 1 addition & 1 deletion internal/bitbucket/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (c *Client) CurrentUser(ctx context.Context) (string, error) {
return "", err
}
if u.UUID == "" {
return "", errors.New("Bitbucket didn't say who the token belongs to")
return "", errors.New("bitbucket didn't say who the token belongs to")
}
return u.UUID, nil
}
Expand Down
8 changes: 4 additions & 4 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ func TestIsValidNotificationFilter(t *testing.T) {
{"fail", true},
{"success", true},
{"change", true},
{"FAIL", true}, // case insensitive
{"SUCCESS", true}, // case insensitive
{"CHANGE", true}, // case insensitive
{"FAIL", true}, // case insensitive
{"SUCCESS", true}, // case insensitive
{"CHANGE", true}, // case insensitive
{" fail ", true}, // whitespace trimmed
{"", false},
{"unknown", false},
{"invalid", false},
{"fail ", true}, // trailing space
{"fail ", true}, // trailing space
{" success", true}, // leading space
}

Expand Down
5 changes: 2 additions & 3 deletions internal/dashboard/collect.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ type Collector struct {
Now func() time.Time
CIRecheck time.Duration

mu sync.Mutex
ci map[string]ciSnapshot
hosts map[string]Source // item host → source, for Enrich
mu sync.Mutex
ci map[string]ciSnapshot
}

type ciSnapshot struct {
Expand Down
13 changes: 0 additions & 13 deletions internal/github/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ import (
"time"
)

// mockRoundTripper implements http.RoundTripper for testing.
type mockRoundTripper struct {
response *http.Response
err error
}

func (m *mockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
if m.err != nil {
return nil, m.err
}
return m.response, nil
}

func TestParsePRURL(t *testing.T) {
tests := []struct {
name string
Expand Down
1 change: 0 additions & 1 deletion internal/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,3 @@ func TestStringNoPanic(t *testing.T) {
})
}
}

Loading