Files
mev-beta/.golangci.yml
Krypto Kajun 3f69aeafcf fix: resolve all compilation issues across transport and lifecycle packages
- Fixed duplicate type declarations in transport package
- Removed unused variables in lifecycle and dependency injection
- Fixed big.Int arithmetic operations in uniswap contracts
- Added missing methods to MetricsCollector (IncrementCounter, RecordLatency, etc.)
- Fixed jitter calculation in TCP transport retry logic
- Updated ComponentHealth field access to use transport type
- Ensured all core packages build successfully

All major compilation errors resolved:
 Transport package builds clean
 Lifecycle package builds clean
 Main MEV bot application builds clean
 Fixed method signature mismatches
 Resolved type conflicts and duplications

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-19 17:23:14 -05:00

390 lines
9.4 KiB
YAML

# MEV Bot Parser - Go Linter Configuration
# Optimized for production-ready MEV/DeFi applications
run:
timeout: 10m
issues-exit-code: 1
tests: true
skip-dirs:
- vendor
- node_modules
skip-files:
- ".*\\.pb\\.go$"
- ".*_generated\\.go$"
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
sort-results: true
linters-settings:
govet:
check-shadowing: true
settings:
printf:
funcs:
- (github.com/fraktal/mev-beta/internal/logger).Logger.Error
- (github.com/fraktal/mev-beta/internal/logger).Logger.Warn
- (github.com/fraktal/mev-beta/internal/logger).Logger.Info
- (github.com/fraktal/mev-beta/internal/logger).Logger.Debug
enable:
- atomicalign
- deepequalerrors
- fieldalignment
- nilness
- sortslice
- unusedwrite
golint:
min-confidence: 0.8
gofmt:
simplify: true
goimports:
local-prefixes: github.com/fraktal/mev-beta
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 3
min-occurrences: 3
ignore-tests: false
ignore-calls: true
depguard:
list-type: blacklist
packages:
# Prevent usage of deprecated/unsafe packages
- io/ioutil
packages-with-error-message:
- io/ioutil: "io/ioutil is deprecated, use os and io packages instead"
misspell:
locale: US
ignore-words:
- someword
lll:
line-length: 120
tab-width: 1
unused:
check-exported: false
unparam:
check-exported: false
nakedret:
max-func-lines: 30
prealloc:
simple: true
range-loops: true
for-loops: false
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport
- ifElseChain
- octalLiteral
- whyNoLint
- wrapperFunc
- importShadow
- unnamedResult
- unnecessaryBlock
settings:
captLocal:
paramsOnly: true
rangeValCopy:
sizeThreshold: 64
gocognit:
min-complexity: 20
nestif:
min-complexity: 5
godox:
keywords:
- TODO
- BUG
- FIXME
- HACK
- XXX
errorlint:
errorf: true
asserts: true
comparison: true
exhaustive:
check-generated: false
default-signifies-exhaustive: false
exportloopref:
check-exported: false
forbidigo:
forbid:
- ^print.*$
- ^fmt\.Print.*$
- ^log\..*$
# Prevent usage of panic in production code
- 'panic\('
exclude_godoc_examples: false
funlen:
lines: 100
statements: 50
gochecknoglobals:
g: true
gochecknoinits:
g: true
godot:
capital: false
period: true
scope: declarations
gomnd:
settings:
mnd:
checks: argument,case,condition,operation,return,assign
ignored-numbers: 0,1,2,3,4,8,10,16,18,32,64,100,256,1000,1024
ignored-functions: strings.SplitN,bytes.SplitN,strconv.FormatInt,make
gomodguard:
allowed:
modules:
- github.com/ethereum/go-ethereum
- github.com/stretchr/testify
- github.com/holiman/uint256
- github.com/shopspring/decimal
blocked:
modules:
- github.com/ugorji/go:
recommendations:
- github.com/json-iterator/go
reason: "ugorji/go has performance issues"
goheader:
values:
const:
COMPANY: Fraktal
PROJECT: MEV Beta
template: |-
Copyright {{ YEAR }} {{ COMPANY }}
This file is part of {{ PROJECT }}.
revive:
min-confidence: 0.8
severity: warning
rules:
- name: blank-imports
- name: context-as-argument
- name: context-keys-type
- name: dot-imports
- name: error-return
- name: error-strings
- name: error-naming
- name: exported
- name: if-return
- name: increment-decrement
- name: var-naming
- name: var-declaration
- name: package-comments
- name: range
- name: receiver-naming
- name: time-naming
- name: unexported-return
- name: indent-error-flow
- name: errorf
- name: empty-block
- name: superfluous-else
- name: unused-parameter
- name: unreachable-code
- name: redefines-builtin-id
- name: waitgroup-by-value
- name: atomic
- name: bare-return
- name: bool-literal-in-expr
- name: constant-logical-expr
linters:
disable-all: true
enable:
# Essential linters for MEV/DeFi applications
- errcheck # Check that error returns are used
- gosimple # Suggest simplifications
- govet # Examine Go source code and report bugs
- ineffassign # Detect ineffectual assignments
- staticcheck # Advanced static analysis
- typecheck # Type checking
- unused # Find unused code
# Code quality linters
- gocyclo # Check cyclomatic complexity
- gofmt # Check formatting
- goimports # Check import formatting
- revive # Fast, configurable, extensible, flexible, and beautiful linter
- misspell # Find commonly misspelled English words
# Performance and optimization linters
- gocritic # Most opinionated Go source code linter
- prealloc # Find slice declarations with non-zero initial length
# Security linters (critical for MEV applications)
- gosec # Inspect source code for security problems
# Bug prevention linters
- bodyclose # Check whether HTTP response body is closed successfully
- errorlint # Find code that will cause problems with error wrapping
- exportloopref # Check for pointers to enclosing loop variables
- goconst # Find repeated strings that could be constants
- godox # Detect FIXME, TODO and other comment keywords
- gomnd # Detect magic numbers
- gomodguard # Check for blocked module imports
- goprintffuncname # Check printf-like functions are named with f at the end
- nilerr # Find code that returns nil even though it checks that error is not nil
- nolintlint # Reports ill-formed or insufficient nolint directives
- rowserrcheck # Check whether Err of rows is checked successfully
- sqlclosecheck # Check that sql.Rows and sql.Stmt are closed
- unconvert # Remove unnecessary type conversions
- unparam # Report unused function parameters
- wastedassign # Find wasted assignment statements
# Style linters
- gochecknoglobals # Check that no global variables exist
- godot # Check if comments end in a period
- lll # Report long lines
- whitespace # Detection of unnecessary whitespaces
# Additional quality linters
- dupl # Code clone detection
- funlen # Tool for detection of long functions
- gocognit # Compute and check the cognitive complexity of functions
- nestif # Report deeply nested if statements
- nlreturn # Check for new line before return
- wsl # Whitespace Linter
issues:
exclude-rules:
# Exclude some linters from running on tests files
- path: _test\.go
linters:
- gocyclo
- errcheck
- dupl
- gosec
- funlen
- goconst
- gochecknoglobals
- lll
- gomnd
# Exclude specific issues in generated files
- path: ".*\\.pb\\.go"
linters:
- all
# Exclude magic number checks for common values in crypto/finance
- text: "mnd: Magic number: 18,"
linters:
- gomnd
- text: "mnd: Magic number: 1000000000000000000,"
linters:
- gomnd
- text: "mnd: Magic number: 500,"
linters:
- gomnd
- text: "mnd: Magic number: 3000,"
linters:
- gomnd
- text: "mnd: Magic number: 10000,"
linters:
- gomnd
# Allow globals in main packages and configuration
- path: cmd/
linters:
- gochecknoglobals
- path: ".*config.*"
linters:
- gochecknoglobals
# Allow longer lines in test files for better readability
- path: _test\.go
text: "line is \\d+ characters"
linters:
- lll
# Allow certain complexity in parser code
- path: pkg/arbitrum/.*parser.*
linters:
- gocyclo
- gocognit
- funlen
# Don't require comments on exported functions in test helpers
- path: test/.*
text: "exported (.+) should have comment"
linters:
- revive
- golint
# Ignore unused parameters in interface implementations
- text: "parameter '.*' seems to be unused, consider removing or renaming it as _"
linters:
- unparam
- revive
# Allow TODO comments in development
- text: "TODO.*"
linters:
- godox
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
new: false
fix: false
severity:
default-severity: error
case-sensitive: false
rules:
- linters:
- dupl
- goconst
- gomnd
- lll
- whitespace
- nlreturn
- wsl
- godot
severity: warning
- linters:
- gosec
- errcheck
- staticcheck
- govet
severity: error