Skip to content

silence lll linter for imports #3251

Closed
@mvrahden

Description

@mvrahden

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

Currently the lll linter warns for long import lines.

This behaviour should be discontinued, since import paths cannot really be influenced much by changing code layout.
The maximum optimization to be done is to reduce or drop import aliases.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.49.0 built from (unknown, mod sum: "h1:I8WHOavragDttlLHtSraHn/h39C+R60bEQ5NoGcHQr8=") on (unknown)

Configuration file

Default config with lll config as follows:

  lll:
    # max line length, lines longer will be reported. Default is 120.
    # '\t' is counted as 1 character by default, and can be changed with the tab-width option
    line-length: 120
    # tab width in spaces. Default to 1.
    tab-width: 1

Go environment

$ go version && go env
go version go1.19.1 darwin/amd64

Verbose output of running

go run github.com/golangci/golangci-lint/cmd/golangci-lint cache clean
# github.com/golangci/golangci-lint/cmd/golangci-lint
ld: warning: -no_pie is deprecated when targeting new OS versions
go run github.com/golangci/golangci-lint/cmd/golangci-lint run -v
# github.com/golangci/golangci-lint/cmd/golangci-lint
ld: warning: -no_pie is deprecated when targeting new OS versions
INFO [config_reader] Config search paths: [./ /some-path-on-my-system /some-other-path-on-my-system /some-path-on-my-system /] 
INFO [config_reader] Used config file .golangci.yaml 
INFO [lintersdb] Active 8 linters: [errcheck gosimple govet ineffassign lll staticcheck typecheck unused] 
INFO [loader] Go packages loading at mode 575 (compiled_files|deps|files|types_sizes|exports_file|imports|name) took 840.030995ms 
INFO [runner/filename_unadjuster] Pre-built 0 adjustments in 1.516694ms 
INFO [linters context/goanalysis] analyzers took 49.397352601s with top 10 stages: buildir: 37.133830681s, inspect: 2.095002854s, fact_deprecated: 1.95023797s, printf: 1.63728323s, ctrlflow: 1.629920841s, fact_purity: 1.483155536s, nilness: 1.23624039s, SA5012: 1.127976062s, typedness: 1.064085254s, unsafeptr: 12.579108ms 
INFO [runner] Processors filtering stat (out/in): nolint: 1/1, max_same_issues: 1/1, skip_files: 1/1, skip_dirs: 1/1, exclude-rules: 1/1, max_from_linter: 1/1, severity-rules: 1/1, filename_unadjuster: 1/1, path_prettifier: 1/1, autogenerated_exclude: 1/1, max_per_file_from_linter: 1/1, path_prefixer: 1/1, sort_results: 1/1, uniq_by_line: 1/1, diff: 1/1, source_code: 1/1, path_shortener: 1/1, cgo: 1/1, identifier_marker: 1/1, exclude: 1/1 
INFO [runner] processing took 541.933µs with stages: nolint: 314.274µs, path_prettifier: 58.8µs, autogenerated_exclude: 45.776µs, source_code: 44.537µs, identifier_marker: 28.568µs, skip_dirs: 25.858µs, exclude-rules: 12.902µs, uniq_by_line: 2.462µs, max_same_issues: 1.952µs, cgo: 1.407µs, path_shortener: 1.046µs, max_from_linter: 899ns, filename_unadjuster: 847ns, exclude: 631ns, skip_files: 541ns, max_per_file_from_linter: 513ns, diff: 251ns, sort_results: 241ns, severity-rules: 240ns, path_prefixer: 188ns 
INFO [runner] linters took 16.801183214s with stages: goanalysis_metalinter: 16.80054929s 
lambda/cmd/lambda.go:19: line is 128 characters (lll)
       "gitlab.my-long-hostname.com/my-long-organization/my-long-project-group/my-long-project-name/lambda/internal/pkg/eventhandler"
INFO File cache stats: 1 entries of total size 4.0KiB 
INFO Memory: 163 samples, avg is 469.1MB, max is 1194.3MB 
INFO Execution took 17.659406238s                 
exit status 1
make: *** [lint] Error 1

Code example or link to a public repository

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions