Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
103 changes: 75 additions & 28 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,80 @@
version: "2"
Copy link
Collaborator

@elevran elevran Nov 4, 2025

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, will do ASAP.

# 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
Loading