Back to all reviewers

justified nolint exceptions

gofiber/fiber
Based on 2 comments
Yaml

When style linters cannot be applied universally across a codebase due to architectural constraints or legitimate use cases, use targeted `//nolint` comments with clear explanations rather than disabling the linter entirely. This approach maintains code style standards while allowing necessary exceptions.

Code Style Yaml

Reviewer Prompt

When style linters cannot be applied universally across a codebase due to architectural constraints or legitimate use cases, use targeted //nolint comments with clear explanations rather than disabling the linter entirely. This approach maintains code style standards while allowing necessary exceptions.

For example, when a linter like interfacebloat conflicts with a core interface design, apply a specific exemption:

//nolint:interfacebloat // Ignore fiber.Ctx - core interface requires many methods
type Ctx interface {
    // ... many methods
}

Similarly, for packages that are dangerous but sometimes necessary:

//nolint:depguard // Using unsafe for performance-critical memory operations
import "unsafe"

This strategy preserves the value of style linters by catching violations in most of the codebase while providing documented exceptions where the rules don’t apply. Each exception should include a brief explanation of why the violation is justified, making the codebase more maintainable and helping future developers understand the reasoning behind style rule exceptions.

2
Comments Analyzed
Yaml
Primary Language
Code Style
Category

Source Discussions