fix: resolve golangci-lint warnings
- Handle ignored errors with explicit _ assignment (errcheck) - Add #nosec comments for false positive G304/G204 warnings (gosec) - Fix misspelling: cancelled -> canceled 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1019,7 +1019,7 @@ func pruneExpiredTombstones() (*TombstonePruneResult, error) {
|
|||||||
}
|
}
|
||||||
allIssues = append(allIssues, &issue)
|
allIssues = append(allIssues, &issue)
|
||||||
}
|
}
|
||||||
file.Close()
|
_ = file.Close() // Best effort close, already read all data
|
||||||
|
|
||||||
// Determine TTL
|
// Determine TTL
|
||||||
ttl := types.DefaultTombstoneTTL
|
ttl := types.DefaultTombstoneTTL
|
||||||
@@ -1052,20 +1052,20 @@ func pruneExpiredTombstones() (*TombstonePruneResult, error) {
|
|||||||
encoder := json.NewEncoder(tempFile)
|
encoder := json.NewEncoder(tempFile)
|
||||||
for _, issue := range kept {
|
for _, issue := range kept {
|
||||||
if err := encoder.Encode(issue); err != nil {
|
if err := encoder.Encode(issue); err != nil {
|
||||||
tempFile.Close()
|
_ = tempFile.Close()
|
||||||
os.Remove(tempPath)
|
_ = os.Remove(tempPath) // Best effort cleanup
|
||||||
return nil, fmt.Errorf("failed to write issue %s: %w", issue.ID, err)
|
return nil, fmt.Errorf("failed to write issue %s: %w", issue.ID, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := tempFile.Close(); err != nil {
|
if err := tempFile.Close(); err != nil {
|
||||||
os.Remove(tempPath)
|
_ = os.Remove(tempPath) // Best effort cleanup
|
||||||
return nil, fmt.Errorf("failed to close temp file: %w", err)
|
return nil, fmt.Errorf("failed to close temp file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Atomically replace
|
// Atomically replace
|
||||||
if err := os.Rename(tempPath, issuesPath); err != nil {
|
if err := os.Rename(tempPath, issuesPath); err != nil {
|
||||||
os.Remove(tempPath)
|
_ = os.Remove(tempPath) // Best effort cleanup
|
||||||
return nil, fmt.Errorf("failed to replace issues.jsonl: %w", err)
|
return nil, fmt.Errorf("failed to replace issues.jsonl: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ Examples:
|
|||||||
existingTombstones[issue.ID] = true
|
existingTombstones[issue.ID] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
file.Close()
|
_ = file.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine which deletions need migration
|
// Determine which deletions need migration
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ EXAMPLES:
|
|||||||
|
|
||||||
response = strings.TrimSpace(strings.ToLower(response))
|
response = strings.TrimSpace(strings.ToLower(response))
|
||||||
if response != "y" && response != "yes" {
|
if response != "y" && response != "yes" {
|
||||||
fmt.Printf("Reset cancelled.\n")
|
fmt.Printf("Reset canceled.\n")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ func isClaudeSetupComplete() bool {
|
|||||||
|
|
||||||
// Check if beads plugin is installed - plugin now provides hooks automatically
|
// Check if beads plugin is installed - plugin now provides hooks automatically
|
||||||
settingsPath := filepath.Join(home, ".claude", "settings.json")
|
settingsPath := filepath.Join(home, ".claude", "settings.json")
|
||||||
|
// #nosec G304 -- settingsPath is constructed from user home dir, not user input
|
||||||
if data, err := os.ReadFile(settingsPath); err == nil {
|
if data, err := os.ReadFile(settingsPath); err == nil {
|
||||||
var settings map[string]interface{}
|
var settings map[string]interface{}
|
||||||
if err := json.Unmarshal(data, &settings); err == nil {
|
if err := json.Unmarshal(data, &settings); err == nil {
|
||||||
@@ -287,7 +288,7 @@ func isClaudeSetupComplete() bool {
|
|||||||
|
|
||||||
// hasBeadsPrimeHooks checks if a settings file has bd prime hooks configured
|
// hasBeadsPrimeHooks checks if a settings file has bd prime hooks configured
|
||||||
func hasBeadsPrimeHooks(settingsPath string) bool {
|
func hasBeadsPrimeHooks(settingsPath string) bool {
|
||||||
data, err := os.ReadFile(settingsPath)
|
data, err := os.ReadFile(settingsPath) // #nosec G304 -- path is either from home dir or relative project path
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ func GitRemoveBeads(beadsDir string) error {
|
|||||||
// Try to remove each file (git rm ignores non-existent files with --ignore-unmatch)
|
// Try to remove each file (git rm ignores non-existent files with --ignore-unmatch)
|
||||||
// Use --force to handle files with staged changes
|
// Use --force to handle files with staged changes
|
||||||
for _, file := range jsonlFiles {
|
for _, file := range jsonlFiles {
|
||||||
cmd := exec.Command("git", "rm", "--ignore-unmatch", "--quiet", "--force", file)
|
cmd := exec.Command("git", "rm", "--ignore-unmatch", "--quiet", "--force", file) // #nosec G204 -- git is a constant, file is from controlled source
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ func CountImpact() (*ImpactSummary, error) {
|
|||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
store, err := sqlite.New(ctx, dbPath)
|
store, err := sqlite.New(ctx, dbPath)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
defer store.Close()
|
defer func() { _ = store.Close() }()
|
||||||
|
|
||||||
// Count all issues including tombstones
|
// Count all issues including tombstones
|
||||||
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{IncludeTombstones: true})
|
allIssues, err := store.SearchIssues(ctx, "", types.IssueFilter{IncludeTombstones: true})
|
||||||
|
|||||||
@@ -1178,12 +1178,12 @@ func (s *SQLiteStorage) executeDelete(ctx context.Context, tx *sql.Tx, inClause
|
|||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var id, issueType string
|
var id, issueType string
|
||||||
if err := rows.Scan(&id, &issueType); err != nil {
|
if err := rows.Scan(&id, &issueType); err != nil {
|
||||||
rows.Close()
|
_ = rows.Close()
|
||||||
return fmt.Errorf("failed to scan issue type: %w", err)
|
return fmt.Errorf("failed to scan issue type: %w", err)
|
||||||
}
|
}
|
||||||
issueTypes[id] = issueType
|
issueTypes[id] = issueType
|
||||||
}
|
}
|
||||||
rows.Close()
|
_ = rows.Close()
|
||||||
|
|
||||||
// 3. Convert issues to tombstones (only for issues that exist)
|
// 3. Convert issues to tombstones (only for issues that exist)
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
|||||||
Reference in New Issue
Block a user