31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
---
|
|
globs: *.go
|
|
description: Code quality and consistency standards
|
|
---
|
|
|
|
# Code Quality Standards
|
|
|
|
## General Principles
|
|
- Keep functions focused and single-purpose
|
|
- Use descriptive variable and function names
|
|
- Add comprehensive logging for debugging
|
|
- Handle errors gracefully with proper context
|
|
|
|
## Specific Rules
|
|
- Never use `fmt.Printf` or `fmt.Println` - always use the logger
|
|
- Avoid redundant log lines right next to each other
|
|
- Use `logger.Warning()` not `logger.Warn()`
|
|
- Include character names and operation context in log messages
|
|
- Use high-level database methods, not raw GORM calls
|
|
|
|
## Code Organization
|
|
- Keep SSO logic in [esi_sso.go](mdc:esi_sso.go)
|
|
- Keep database abstraction in [db.go](mdc:db.go)
|
|
- Main application logic in [main.go](mdc:main.go)
|
|
- Use interfaces for database operations to enable testing
|
|
|
|
## Error Handling
|
|
- Always log errors with sufficient context
|
|
- Don't swallow errors silently
|
|
- Provide meaningful error messages to users
|
|
- Handle network timeouts and API failures gracefully |