Skip to content

silence lll linter for imports #3251

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

Closed
4 tasks done
mvrahden opened this issue Sep 29, 2022 · 7 comments · Fixed by #3288
Closed
4 tasks done

silence lll linter for imports #3251

mvrahden opened this issue Sep 29, 2022 · 7 comments · Fixed by #3288
Labels
bug Something isn't working

Comments

@mvrahden
Copy link

mvrahden commented Sep 29, 2022

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

@mvrahden mvrahden added the bug Something isn't working label Sep 29, 2022
@ldez
Copy link
Member

ldez commented Sep 29, 2022

Hello,

Can you fill in the issue description? thank you.

@ldez ldez added the feedback required Requires additional feedback label Sep 29, 2022
@mvrahden
Copy link
Author

@ldez done

@ldez
Copy link
Member

ldez commented Sep 29, 2022

you removed some questions, can you restore them and fill in them? thank you

@mvrahden
Copy link
Author

@ldez done

@ldez ldez removed the feedback required Requires additional feedback label Oct 1, 2022
@ibez92
Copy link
Contributor

ibez92 commented Oct 9, 2022

Hello,

I'm looking for first issue. Can I take this one?

What do you think about lll setting like skipImports?

@ldez
Copy link
Member

ldez commented Oct 9, 2022

Hello,

What do you think about lll settings like skipImports?

I think that the problem must be fixed without an option because it's impossible to reduce an import.

@ibez92
Copy link
Contributor

ibez92 commented Oct 9, 2022

Ok, thank you. I will try to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants