Skip to content

Commit

Permalink
.golangci: Replace lll with custom ll
Browse files Browse the repository at this point in the history
  • Loading branch information
ellemouton committed Dec 2, 2024
1 parent ab7aae0 commit c5d849e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ cmd/cmd
*.key
*.hex

# Ignore the custom linter binary if it is built.
custom-gcl

cmd/lncli/lncli

# Files from mobile build.
Expand Down
27 changes: 19 additions & 8 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ run:
- integration

linters-settings:
custom:
ll:
type: "module"
description: "Custom lll linter with 'S' log line exclusion."
settings:
# Max line length, lines longer will be reported.
line-length: 80
# Tab width in spaces.
tab-width: 8
# The regex that we will use to detect the start of an `S` log line.
log-regex: "^\\s*.*(L|l)og\\.(Info|Debug|Trace|Warn|Error|Critical)S\\("

errorlint:
# Check for incorrect fmt.Errorf error wrapping.
errorf: true
Expand All @@ -45,16 +57,11 @@ linters-settings:
excludes:
- G402 # Look for bad TLS connection settings.
- G306 # Poor file permissions used when writing to a new file.
- G601 # Implicit memory aliasing in for loop.

staticcheck:
checks: ["-SA1019"]

lll:
# Max line length, lines longer will be reported.
line-length: 80
# Tab width in spaces.
tab-width: 8

funlen:
# Checks the number of lines in a function.
# If lower than 0, disable the check.
Expand Down Expand Up @@ -105,6 +112,10 @@ linters-settings:
linters:
enable-all: true
disable:
# We instead use our own custom line length linter called `ll` since
# then we can ignore log lines.
- lll

# Global variables are used in many places throughout the code base.
- gochecknoglobals

Expand Down Expand Up @@ -170,7 +181,7 @@ linters:
- wrapcheck

# Allow dynamic errors.
- err113
- goerr113

# We use ErrXXX instead.
- errname
Expand All @@ -186,7 +197,6 @@ linters:
# The linter is too aggressive and doesn't add much value since reviewers
# will also catch magic numbers that make sense to extract.
- gomnd
- mnd

# Some of the tests cannot be parallelized. On the other hand, we don't
# gain much performance with this check so we disable it for now until
Expand All @@ -204,6 +214,7 @@ linters:
- depguard
- gosmopolitan
- intrange
- goconst


issues:
Expand Down

0 comments on commit c5d849e

Please sign in to comment.