-
Notifications
You must be signed in to change notification settings - Fork 9
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
lll should not complain about long strings #11
Comments
One more reason:
|
I also believe that Struct tags should be ignored too (they are also strings) |
I made golangci/golangci-lint#3983 to track this in golangci-lint repository. |
One of, if not the most popular style guide in the world is the Airbnb JavaScript Style Guide, which represents best-practice across a lot of the JavaScript and TypeScript ecosystem.
In the style guide, it mentions:
This policy seems sensible. With the "bad" code example above, grepping through a project for "thrown because of Batman" would return 0 results.
One other problem with using string concatenation is that realignment is tedious when you have to remove a sentence. And it introduces unnecessary Git noise. e.g.
-->
In JavaScript/TypeScript land, the most popular linter is eslint, which is similar to lll in that it has a max-len rule. It has an
ignoreStrings
flag which is set to true by default - a sensible default.The implementation for this is located here: https://github.com/eslint/eslint/blob/master/lib/rules/max-len.js#L314-L315
As you can see, it is extremely simple.
In Golang land, I think the practice of ignoring strings should also apply, for precisely the same reasons. I was curious to see if other big Go projects were breaking up long strings, so I took a look at Kubernetes, which is probably the biggest. I was only able to find one instance of concatenated strings. Instead, most code is written like like this.
Similar to eslint, is it possible to add an
ignoreStrings
flag to lll? Currently, I have gotten so fed up with adding//nolint: lll
everywhere that I have stopped using the linter, but it is a great tool and I would love to be able to use it again in the future.The text was updated successfully, but these errors were encountered: