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)
|
||||
}
|
||||
file.Close()
|
||||
_ = file.Close() // Best effort close, already read all data
|
||||
|
||||
// Determine TTL
|
||||
ttl := types.DefaultTombstoneTTL
|
||||
@@ -1052,20 +1052,20 @@ func pruneExpiredTombstones() (*TombstonePruneResult, error) {
|
||||
encoder := json.NewEncoder(tempFile)
|
||||
for _, issue := range kept {
|
||||
if err := encoder.Encode(issue); err != nil {
|
||||
tempFile.Close()
|
||||
os.Remove(tempPath)
|
||||
_ = tempFile.Close()
|
||||
_ = os.Remove(tempPath) // Best effort cleanup
|
||||
return nil, fmt.Errorf("failed to write issue %s: %w", issue.ID, err)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
// Atomically replace
|
||||
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)
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ Examples:
|
||||
existingTombstones[issue.ID] = true
|
||||
}
|
||||
}
|
||||
file.Close()
|
||||
_ = file.Close()
|
||||
}
|
||||
|
||||
// Determine which deletions need migration
|
||||
|
||||
@@ -139,7 +139,7 @@ EXAMPLES:
|
||||
|
||||
response = strings.TrimSpace(strings.ToLower(response))
|
||||
if response != "y" && response != "yes" {
|
||||
fmt.Printf("Reset cancelled.\n")
|
||||
fmt.Printf("Reset canceled.\n")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -256,6 +256,7 @@ func isClaudeSetupComplete() bool {
|
||||
|
||||
// Check if beads plugin is installed - plugin now provides hooks automatically
|
||||
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 {
|
||||
var settings map[string]interface{}
|
||||
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
|
||||
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 {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user