-
Notifications
You must be signed in to change notification settings - Fork 105
feat: enhance golangci-lint configuration for better code quality #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0b021fc
4dc254d
e7e5c93
7f7b6e8
2ed3d19
fa6854a
ed98e38
a1c13a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,70 @@ | ||
| version: "2" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rishi-jat "version: 2" is required and must be explicitly set (version 1 uses a different file format - see lint action failure on the PR).
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, will do ASAP.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rishi-jat the latest commit is still missing the "version: 2" line and fails passing the required lint test. |
||
| # Enhanced golangci-lint configuration for llm-d-inference-scheduler | ||
| # Expanded from 22 to 30+ linters for improved code quality, security, and maintainability | ||
| # Focus on practical improvements suitable for Kubernetes controller development | ||
|
|
||
| run: | ||
| timeout: 5m | ||
| timeout: 10m | ||
| allow-parallel-runners: true | ||
|
|
||
| formatters: | ||
| enable: | ||
| - goimports | ||
| - gofmt | ||
|
|
||
| linters: | ||
| enable: | ||
| - copyloopvar | ||
| - dupword | ||
| - durationcheck | ||
| - fatcontext | ||
| - ginkgolinter | ||
| - gocritic | ||
| - govet | ||
| - loggercheck | ||
| - misspell | ||
| - perfsprint | ||
| - revive | ||
| - unconvert | ||
| - makezero | ||
| - errcheck | ||
| - goconst | ||
| - ineffassign | ||
| - nakedret | ||
| - prealloc | ||
| - unparam | ||
| - unused | ||
| # === ORIGINAL LINTERS (maintained) === | ||
| - copyloopvar # Loop variable capture issues (Go 1.22+) | ||
| - dupword # Duplicate words in comments | ||
| - durationcheck # Duration multiplication issues (important for k8s timers) | ||
| - fatcontext # Nested contexts in loops | ||
| - ginkgolinter # Ginkgo test framework linting (CRITICAL - heavily used) | ||
| - gocritic # Comprehensive static code analyzer | ||
| - govet # Go's built-in static analyzer | ||
| - loggercheck # Logger usage patterns (CRITICAL for controller-runtime) | ||
| - misspell # Spelling mistakes in comments | ||
| - perfsprint # fmt.Sprintf performance issues | ||
| - revive # Go best practices and style guide | ||
| - unconvert # Unnecessary type conversions | ||
| - makezero # Slice declarations with non-zero length | ||
| - errcheck # Unchecked errors (CRITICAL for robust Go code) | ||
| - goconst # Repeated strings that should be constants | ||
| - ineffassign # Ineffectual assignments | ||
| - nakedret # Naked returns in functions longer than specified length | ||
| - prealloc # Slice pre-allocation opportunities | ||
| - unparam # Unused function parameters | ||
| - unused # Unused code (helps reduce bloat) | ||
|
|
||
| # === NEW HIGH-VALUE ADDITIONS === | ||
| # Formatting and style consistency | ||
| - gofmt # Ensures code is gofmt-ed | ||
| - goimports # Import organization and unused import removal | ||
|
|
||
| # Security enhancements | ||
| - gosec # Security vulnerability scanner | ||
| - bodyclose # Ensures HTTP response bodies are closed | ||
|
|
||
| # Context and resource management (critical for k8s controllers) | ||
| - contextcheck # Proper context usage patterns | ||
| - noctx # HTTP requests without context | ||
|
|
||
| # Character encoding safety | ||
| - asciicheck # Non-ASCII identifiers | ||
| - bidichk # Dangerous unicode character sequences | ||
|
|
||
| # Enhanced error handling | ||
| - errorlint # Error wrapping scheme validation | ||
| - nilerr # Nil error handling pattern issues | ||
|
|
||
| # Code quality improvements | ||
| - testpackage # Test package naming conventions | ||
|
|
||
| # Import organization for large projects | ||
| - gci # Advanced import grouping | ||
|
|
||
| disable: | ||
| # Linters that are too restrictive or noisy for this project type | ||
| - varnamelen # Variable name length (Go idioms favor short names) | ||
| - exhaustruct # Exhaustive struct initialization (too restrictive) | ||
| - nlreturn # Newlines before returns (too opinionated) | ||
| - wsl # Whitespace linter (too opinionated) | ||
| - lll # Line length (handled by gofmt) | ||
| - cyclop # Cyclomatic complexity (can be overly strict) | ||
| - funlen # Function length (can be overly strict) | ||
| - nestif # Nested if statements (can be overly strict) | ||
| - gocognit # Cognitive complexity (can be overly strict) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should this change be part of this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the rationale for removing the specific version? will it run with some
latest v2?