Feature 101/GitHub import #104
No reviewers
Labels
No labels
bug
ci
documentation
duplicate
enhancement
feature
good first issue
help wanted
invalid
performance
priority
P0
priority
P1
priority
P2
question
refactor
size
L
size
M
size
S
size
XL
size
XS
tests
trivial
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
noe.trevino/paso!104
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature-101/github-import"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Checklist
CONTRIBUTING.mdgo test ./... -race) locallygofmt -w .andgolangci-lint run ./...respectivelyREADME.mdif applicableSummary
Closes #101
Adds github import command with a spinner.
Not adding into the tui until we do the jira one as will.
When that happens, we can add a command or something
Informational Warning:
The snapshot tests have been changed.
Please add a screenshot showing what has been changed, and a description of why it was changed.
If you do not provide an explanation and screenshot in 3 days, this PR will be closed.
@TheNoeTrevino
Changed snapshot files (1 files)
internal/testing/snapshots/cli/testdata/e2e/task-show.golden@ -0,0 +118,4 @@targetColumnID = col.ID}issue, err := cliInstance.App.GitHubFetcher.FetchIssue(ctx, issueNumber)Dead code —
cobra.ExactArgs(1)on the command definition (line 104) means cobra rejects the call beforeExecuteis reached if no argument is provided. This check can never be true.@ -0,0 +175,4 @@func parseImportFlags(_ *cobra.Command) error {return nil}resolveDefaultAuthor()callsconfig.Load()(a file read) on every comment with an empty author. Hoist this before the loop so the config is read at most once.@ -0,0 +136,4 @@defaultAuthor := resolveDefaultAuthor()commentsImported := 0for _, comment := range issue.Comments {resolveDefaultAuthor()callsconfig.Load()(a file read) on every comment iteration where the author is empty. Hoist the call before the loop so config is read at most once regardless of how many comments have empty authors.@ -0,0 +135,4 @@assert.Empty(t, issue.Comments)}func TestCheckInstalled_GHExists(t *testing.T) {This test assumes
ghis onPATHin every environment. Ifghis absent (e.g. a minimal CI image) the test fails spuriously. Either add a skip guard (if _, err := exec.LookPath("gh"); err != nil { t.Skip("gh not installed") }) or mocklookPathasTestCheckInstalled_GHMissingdoes.Review Summary
Three concrete issues found:
1. Dead guard (
import.go:120–122)The
len(args.Args) == 0check insideExecuteis unreachable.cobra.ExactArgs(1)already rejects the command beforeExecuteis called when the argument is missing. Remove the guard.2. Repeated
config.Load()inside comment loop (import.go~line 137)resolveDefaultAuthor()callsconfig.Load()(a file read) once per comment with an empty author. Hoist the call above the loop:defaultAuthor := resolveDefaultAuthor().3.
TestCheckInstalled_GHExistshas a hard environment dependency (github_test.go~line 138)The test uses the real
exec.LookPathand will fail in any environment withoutghonPATH. Add a skip guard or mocklookPathconsistently withTestCheckInstalled_GHMissing.Score: 8/10