Skip to content
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

URLs are also reported as too long #12

Open
arvenil opened this issue Sep 15, 2020 · 5 comments
Open

URLs are also reported as too long #12

arvenil opened this issue Sep 15, 2020 · 5 comments

Comments

@arvenil
Copy link

arvenil commented Sep 15, 2020

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
Copy link

Same spirit of #11

@mitar
Copy link

mitar commented Aug 2, 2023

I made golangci/golangci-lint#3983 to track this in golangci-lint repository.

@ldez
Copy link

ldez commented Aug 3, 2023

.golangci.yml
linters:
  disable-all: true
  enable:
    - lll
    - typecheck

linters-settings:
  lll:
    line-length: 50
without nolint
package main

import "fmt"

// main runs the app.
// https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15
func main() {
	fmt.Println("Foo")
}
$ golangci-lint run 
main.go:6: line is 90 characters (lll)
// https://github.com/walle/lll/blob/4438bccd245f7e87a5a69023625f01e7035c05c0/utils.go#L15
$
with nolint
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")
}
$ golangci-lint run 
$

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

@mitar
Copy link

mitar commented Aug 3, 2023

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

@ldez
Copy link

ldez commented Aug 3, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants