-
Notifications
You must be signed in to change notification settings - Fork 99
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
Open
rishi-jat
wants to merge
3
commits into
llm-d:main
Choose a base branch
from
rishi-jat:enhance/golangci-lint-configuration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,33 +1,80 @@ | ||
| version: "2" | ||
| # 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 | ||
| allow-parallel-runners: true | ||
|
|
||
| formatters: | ||
| enable: | ||
| - goimports | ||
| - gofmt | ||
| timeout: 10m | ||
| modules-download-mode: readonly | ||
|
|
||
| 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) | ||
|
|
||
| issues: | ||
| # Exclude certain linters from running on files until build dependencies are resolved | ||
| exclude-rules: | ||
| - path: pkg/plugins/ | ||
| linters: | ||
| - goanalysis_metalinter | ||
| - path: pkg/scheduling/pd/ | ||
| linters: | ||
| - goanalysis_metalinter | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
@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).
Please restore this line
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.
okay, will do ASAP.