Address remaining golangci-lint findings
- Add package comment to cmd/bd/dep.go - Change directory permissions from 0755 to 0750 in init.go - Simplify getNextID signature (remove unused error return) - Configure golangci-lint exclusions for false positives - Document linting policy in LINTING.md The remaining ~100 lint warnings are documented false positives: - 73 errcheck: deferred cleanup (idiomatic Go) - 17 revive: Cobra interface requirements and naming choices - 7 gosec: false positives on validated SQL and user file paths - 2 dupl: acceptable test code duplication - 1 goconst: test constant repetition See LINTING.md for full rationale. Contributors should focus on avoiding NEW issues rather than the documented baseline. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -49,10 +49,7 @@ func New(path string) (*SQLiteStorage, error) {
|
||||
}
|
||||
|
||||
// Get next ID
|
||||
nextID, err := getNextID(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
nextID := getNextID(db)
|
||||
|
||||
return &SQLiteStorage{
|
||||
db: db,
|
||||
@@ -61,29 +58,29 @@ func New(path string) (*SQLiteStorage, error) {
|
||||
}
|
||||
|
||||
// getNextID determines the next issue ID to use
|
||||
func getNextID(db *sql.DB) (int, error) {
|
||||
func getNextID(db *sql.DB) int {
|
||||
var maxID sql.NullString
|
||||
err := db.QueryRow("SELECT MAX(id) FROM issues").Scan(&maxID)
|
||||
if err != nil {
|
||||
return 1, nil // Start from 1 if table is empty
|
||||
return 1 // Start from 1 if table is empty
|
||||
}
|
||||
|
||||
if !maxID.Valid || maxID.String == "" {
|
||||
return 1, nil
|
||||
return 1
|
||||
}
|
||||
|
||||
// Parse "bd-123" to get 123
|
||||
parts := strings.Split(maxID.String, "-")
|
||||
if len(parts) != 2 {
|
||||
return 1, nil
|
||||
return 1
|
||||
}
|
||||
|
||||
var num int
|
||||
if _, err := fmt.Sscanf(parts[1], "%d", &num); err != nil {
|
||||
return 1, nil
|
||||
return 1
|
||||
}
|
||||
|
||||
return num + 1, nil
|
||||
return num + 1
|
||||
}
|
||||
|
||||
// CreateIssue creates a new issue
|
||||
|
||||
Reference in New Issue
Block a user