Skip to content

Commit 3194ff4

Browse files
nodeselectorCopilot
andcommitted
style(pipeline): gofmt, drop duplicate doc comments and dead var
Address Copilot review on #25: gofmt the checks and pipeline files (parserlock import ordering), remove the accidentally duplicated doc comments across parse.go, reach_partition.go, reach_findings.go, and finding_enrich.go, replace the stray CollectReachDeps doc above populateInventoryParents with an accurate one, and drop the dead endpoint variable in profile.classifyPath. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ac2c73b commit 3194ff4

12 files changed

Lines changed: 11 additions & 86 deletions

File tree

internal/pipeline/checks/finding.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package checks
22

33
import (
4-
"github.com/github/gh-actions-pin/internal/dep"
54
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
5+
"github.com/github/gh-actions-pin/internal/dep"
66
)
77

88
// Finding represents a single diagnosed issue (or clean bill) for a workflow.

internal/pipeline/checks/impostor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package checks
33
import (
44
"context"
55

6+
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
67
"github.com/github/gh-actions-pin/internal/ghapi"
78
"github.com/github/gh-actions-pin/internal/pinpool"
89
"github.com/github/gh-actions-pin/internal/resolve"
910
"github.com/github/gh-actions-pin/internal/tag"
10-
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
1111
)
1212

1313
// ReachabilityChecker is the subset of resolve.Resolver needed to verify

internal/pipeline/checks/misleading.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/github/gh-actions-pin/internal/resolve"
98
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
9+
"github.com/github/gh-actions-pin/internal/resolve"
1010
)
1111

1212
// checkMisleadingSha emits MisleadingSHA when a uses: ref looks

internal/pipeline/checks/parsed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package checks
22

33
import (
4-
"github.com/github/gh-actions-pin/internal/dep"
54
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
5+
"github.com/github/gh-actions-pin/internal/dep"
66
)
77

88
// ParsedWorkflow holds the per-workflow parse result that both phases need.

internal/pipeline/checks/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import (
44
"context"
55
"strings"
66

7+
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
78
"github.com/github/gh-actions-pin/internal/dep"
89
"github.com/github/gh-actions-pin/internal/workflowfile"
9-
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
1010
)
1111

1212
// RunChecks evaluates all enabled validators against the given parsed

internal/pipeline/checks/run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"strings"
77
"testing"
88

9-
"github.com/github/gh-actions-pin/internal/resolve"
109
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
10+
"github.com/github/gh-actions-pin/internal/resolve"
1111
)
1212

1313
// Typed map keys for the test stub: a small struct per lookup tuple so

internal/pipeline/checks/structural.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import (
44
"fmt"
55
"strings"
66

7-
"github.com/github/gh-actions-pin/internal/dep"
87
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
8+
"github.com/github/gh-actions-pin/internal/dep"
99
)
1010

1111
// checkNotPinned emits NotPinned for any uses: ref that has no

internal/pipeline/finding_enrich.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ func attachParent(f *checks.Finding, depByKey map[string]dep.Dependency, directN
3434
}
3535
}
3636

37-
// isTransitivePin reports whether the finding refers to a dep reached via
38-
// composite expansion (i.e. has parents in the parent map).
39-
4037
// isTransitivePin reports whether the finding refers to a dep reached via
4138
// composite expansion (i.e. has parents in the parent map).
4239
func isTransitivePin(f checks.Finding, depByKey map[string]dep.Dependency, parentMap map[string][]string) bool {
@@ -49,16 +46,9 @@ func isTransitivePin(f checks.Finding, depByKey map[string]dep.Dependency, paren
4946
return len(parentMap[f.Dependency.Key()]) > 0
5047
}
5148

52-
// CollectReachDeps returns the deduplicated union of existing deps across the
53-
// given parsed workflows that will need a fresh reachability network check
54-
// once diagnostics runs. It mirrors the per-workflow partition diagnose
55-
// performs internally (see partitionReachByLive) but operates over the union,
56-
// so callers can pre-warm CheckReachabilityAll once across every unresolved
57-
// workflow instead of paying the per-workflow repo-warmup + per-dep
58-
// concurrency cost serially. Pass live as the result of a single
59-
// ResolveAllRecursive over the union of refs (the resolver cache makes the
60-
// per-workflow re-lookups inside diagnose free).
61-
49+
// populateInventoryParents fills in the Parents field for transitive inventory
50+
// entries (those not marked Direct and without parents yet) by looking up each
51+
// entry's dep key in parentMap.
6252
func populateInventoryParents(inventory []checks.InventoryEntry, parentMap map[string][]string) {
6353
for i := range inventory {
6454
if inventory[i].Direct || len(inventory[i].Parents) > 0 {

internal/pipeline/parse.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ package pipeline
33
import (
44
"context"
55

6+
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
67
"github.com/github/gh-actions-pin/internal/dep"
78
"github.com/github/gh-actions-pin/internal/ghapi"
89
"github.com/github/gh-actions-pin/internal/lockfile"
910
"github.com/github/gh-actions-pin/internal/pinpool"
1011
"github.com/github/gh-actions-pin/internal/pipeline/checks"
1112
"github.com/github/gh-actions-pin/internal/resolve"
1213
"github.com/github/gh-actions-pin/internal/workflowfile"
13-
parserlock "github.com/github/actions-lockfile/go/pkg/lockfile"
1414
)
1515

1616
// Diagnose scans workflows and produces findings for each.
@@ -36,10 +36,6 @@ func Diagnose(ctx context.Context, paths []string, r *resolve.Resolver, store *l
3636
return DiagnoseParsed(ctx, parsed, r, store, pool)
3737
}
3838

39-
// ParseAll loads and parses every workflow path, returning a slice in input
40-
// order. onScan, if non-nil, fires with 1-based progress before each workflow
41-
// is parsed so the UI can render [i/N] without leaking resolver detail.
42-
4339
// ParseAll loads and parses every workflow path, returning a slice in input
4440
// order. onScan, if non-nil, fires with 1-based progress before each workflow
4541
// is parsed so the UI can render [i/N] without leaking resolver detail.
@@ -72,10 +68,6 @@ func ParseAll(paths []string, store *lockfile.State, onScan func(done, total int
7268
return out
7369
}
7470

75-
// CollectResolvable returns the deduplicated union of refs and existing deps
76-
// across all parsed workflows. Use the returned slices to pre-warm the
77-
// resolver caches once before per-workflow diagnostics.
78-
7971
// CollectResolvable returns the deduplicated union of refs and existing deps
8072
// across all parsed workflows. Use the returned slices to pre-warm the
8173
// resolver caches once before per-workflow diagnostics.

internal/pipeline/reach_findings.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,16 +93,6 @@ func reachabilityComplementFindings(
9393
return out
9494
}
9595

96-
// liveReachImpostorFindings emits checks.ImpostorCommit for live-resolved
97-
// SHAs that come back Unreachable from the live-direct sweep. Operates on
98-
// synthetic live deps (not pw.ExistingDeps), so it fires for unpinned and
99-
// transitive-not-in-lockfile cases that reachabilityComplementFindings
100-
// (keyed on existing deps) can't see.
101-
//
102-
// Suppresses duplicates against any prior impostor/forgery finding for the
103-
// same dep key — the engine's checkImpostorCommit may have already emitted
104-
// for a direct ref via the live-ref-vs-locked compare in check_misleading.
105-
10696
// liveReachImpostorFindings emits checks.ImpostorCommit for live-resolved
10797
// SHAs that come back Unreachable from the live-direct sweep. Operates on
10898
// synthetic live deps (not pw.ExistingDeps), so it fires for unpinned and

0 commit comments

Comments
 (0)