Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.5k
lll: ignore comments containing only URL#3986
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -5,6 +5,7 @@ import ( | ||
| "fmt" | ||
| "go/token" | ||
| "os" | ||
| "regexp" | ||
| "strings" | ||
| "sync" | ||
| "unicode/utf8" | ||
| @@ -89,6 +90,8 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r | ||
| lineNumber := 0 | ||
| multiImportEnabled := false | ||
| urlComment := regexp.MustCompile(`\s*//\s*http(s)?://[^ ]+$`) | ||
Contributor
| ||
| scanner := bufio.NewScanner(f) | ||
| for scanner.Scan() { | ||
| lineNumber++ | ||
| @@ -100,6 +103,10 @@ func getLLLIssuesForFile(filename string, maxLineLen int, tabSpaces string) ([]r | ||
| continue | ||
| } | ||
| if urlComment.MatchString(line) { | ||
| continue | ||
| } | ||
| if strings.HasPrefix(line, "import") { | ||
| multiImportEnabled = strings.HasSuffix(line, "(") | ||
| continue | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //golangcitest:args -Elll | ||
| //golangcitest:config_path testdata/configs/lll.yml | ||
| package testdata | ||
| import ( | ||
| "fmt" | ||
| _"unsafe" | ||
| ) | ||
| // https://github.com/golangci/golangci-lint/blob/master/pkg/result/processors/testdata/autogen_exclude_block_comment.go | ||
ldez marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| funclllCommentURL1() { | ||
| // https://github.com/golangci/golangci-lint/blob/master/pkg/result/processors/testdata/autogen_exclude_block_comment.go | ||
| fmt.Println("lll") | ||
| } | ||
| // https://github.com/golangci/golangci-lint/blob/master/pkg/result/processors/testdata/autogen_exclude_block_comment.go foobar // want "line is 160 characters" | ||
| funclllCommentURL2() { | ||
| // https://github.com/golangci/golangci-lint/blob/master/pkg/result/processors/testdata/autogen_exclude_block_comment.go foobar // want "line is 164 characters" | ||
| fmt.Println("lll") | ||
| } | ||