walle / lll

Line length linter
MIT License
65 stars 9 forks source link

URLs are also reported as too long #12

Open arvenil opened 3 years ago

arvenil commented 3 years ago

I find this annoying, but apparently if you have a really long link, and it's the only thing in the line, it is still being reported. I often put in comments links to other projects as a reference e.g.

// https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15

nolint:lll is also not respected in comments

marco-m-pix4d commented 2 years ago

Same spirit of #11

mitar commented 1 year ago

I made https://github.com/golangci/golangci-lint/issues/3983 to track this in golangci-lint repository.

ldez commented 1 year ago
.golangci.yml ```yml linters: disable-all: true enable: - lll - typecheck linters-settings: lll: line-length: 50 ```
without nolint ```go package main import "fmt" // main runs the app. // https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15 func main() { fmt.Println("Foo") } ``` ```console $ golangci-lint run main.go:6: line is 90 characters (lll) // https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15 $ ```
with nolint ```go package main import "fmt" // main runs the app. // https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15 // //nolint:lll func main() { fmt.Println("Foo") } ``` ```console $ golangci-lint run $ ```

nolint is not a basic comment but a directive (no space between // and nolint).

mitar commented 1 year ago

Yes, but nolint then works for the whole function, not just the comment. See https://github.com/golangci/golangci-lint/pull/3986 as PR to address this.

ldez commented 1 year ago

Yes, I know because it's what I said in this PR...

I was just waiting for the merge of my PR before adding a new comment here.