chore: delete code no binary or test reaches
This commit is contained in:
1 parent
7986ccb3f7
commit
01acb97f96
34 files changed
+1
-1483
No files matched your search
@@ -548,24 +548,6 @@ func AddedLines(files []FileChange) []AddedLine {
|
||||
return added
|
||||
}
|
||||
|
||||
// MapLine maps a line of the file a change produces onto the diff: a line the
|
||||
// change added, a line a hunk quotes as context, or a line no hunk contains.
|
||||
func MapLine(files []FileChange, path string, line int) LineKind {
|
||||
for _, file := range files {
|
||||
if file.Path != path {
|
||||
continue
|
||||
}
|
||||
for _, hunk := range file.Hunks {
|
||||
for _, placed := range hunk.positions() {
|
||||
if placed.Line == line {
|
||||
return placed.Kind
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return LineOutside
|
||||
}
|
||||
|
||||
// SummarizeFiles computes the aggregate statistics of a parsed change.
|
||||
func SummarizeFiles(files []FileChange) DiffStats {
|
||||
stats := DiffStats{TotalFiles: len(files)}
|
||||
|
||||
@@ -125,46 +125,6 @@ func prepareWorktreeStage(name string, target func(*TaskContext) (PrepareTarget,
|
||||
}}
|
||||
}
|
||||
|
||||
// StageCommit commits everything in the worktree without pushing --
|
||||
// used mid-workflow so a PR tells its story in multiple commits (TDD:
|
||||
// failing tests first, fix second). An empty tree parks.
|
||||
func StageCommit(name string, message func(*TaskContext) string) Stage {
|
||||
return Stage{Name: name, Run: func(ctx context.Context, tc *TaskContext) error {
|
||||
changed, err := tc.Trees.CommitAll(ctx, tc.Dir, message(tc))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !changed {
|
||||
return fmt.Errorf("worktree has no changes to commit")
|
||||
}
|
||||
tc.captureChanges(ctx, capturedAfterCommit)
|
||||
return nil
|
||||
}}
|
||||
}
|
||||
|
||||
// StageCommitPush commits the worktree and pushes the branch. With no changes
|
||||
// it closes the issue with a comment, unless a baseline fix was committed, in
|
||||
// which case it still pushes.
|
||||
func StageCommitPush(message func(*TaskContext) string) Stage {
|
||||
return Stage{Name: "commit-push", Run: func(ctx context.Context, tc *TaskContext) error {
|
||||
if tc.BuildNoChanges {
|
||||
return closeNoChangesIssue(ctx, tc)
|
||||
}
|
||||
changed, err := tc.Trees.CommitAll(ctx, tc.Dir, message(tc))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !changed && !tc.BaselineFixed {
|
||||
return fmt.Errorf("worktree has no changes to commit")
|
||||
}
|
||||
if err := tc.Trees.Push(ctx, tc.Dir, tc.Branch); err != nil {
|
||||
return err
|
||||
}
|
||||
tc.captureChanges(ctx, capturedAfterCommitPush)
|
||||
return nil
|
||||
}}
|
||||
}
|
||||
|
||||
func closeNoChangesIssue(ctx context.Context, tc *TaskContext) error {
|
||||
if !tc.Task.IsForgeBacked() {
|
||||
tc.Outcome = Outcome{Status: StatusCompleted, Detail: "completed -- no changes required"}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"maps"
|
||||
"slices"
|
||||
"sync"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/domain/lifecycle"
|
||||
@@ -119,16 +118,3 @@ func (m *Manager) Settings() map[string]any {
|
||||
defer m.mu.Unlock()
|
||||
return maps.Clone(m.settings)
|
||||
}
|
||||
|
||||
// StepTypes returns every registered step type name, sorted.
|
||||
func (m *Manager) StepTypes() []string {
|
||||
registry := m.Registry()
|
||||
return slices.Sorted(maps.Keys(registry))
|
||||
}
|
||||
|
||||
// Providers returns the registered provider names, sorted.
|
||||
func (m *Manager) Providers() []string {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
return slices.Sorted(slices.Values(m.providers))
|
||||
}
|
||||
Reference in new issue
Block a user