You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes a line is unavoidably long and the line-length-limit rule triggers on it anyway, and a comment-based exclusion must be defined. For example:
// revive:disable:line-length-limit To allow go generate command
//go:generate go run ../../../cmd/stackwrapper/main.go -output stack_wrapper.go -type Monetization -dir ../../thrift/monetization/service -output-type StackWrapper
//revive:enable
In this case, the go:generate command must remain on one line, and there is no way to wrap it to a second line. One proposal to do so was declined: golang/go#46050
Other examples may also exist: for example users may want to carve out exclusions for long URLs (i.e. lines that match https://).
While it is possible to carve out exclusions every time this happens such as in the code example above, it is cumbersome to do so.
Describe the solution you'd like
A similar standalone linter, the lll linter, offers an exclude parameter which excludes lines matching a regular expression. If the line-length-limit rule could offer a similar option to exclude lines based on a regular expression, then we could set it to exclude checking lines with a pattern like go:generate.
Describe alternatives you've considered
Issue #701 proposes a somewhat similar scheme of excluding rules based on whether the filename matches a regular expression. Rather than have a line exclusion specific to line-length-limit, we could allow excluding any rule based on whether the line matches a regular expression. This could be more generic if other rules could benefit from line-regexp-specific exclusions.
Additional context
None
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Sometimes a line is unavoidably long and the
line-length-limit
rule triggers on it anyway, and a comment-based exclusion must be defined. For example:In this case, the
go:generate
command must remain on one line, and there is no way to wrap it to a second line. One proposal to do so was declined: golang/go#46050Other examples may also exist: for example users may want to carve out exclusions for long URLs (i.e. lines that match
https://
).While it is possible to carve out exclusions every time this happens such as in the code example above, it is cumbersome to do so.
Describe the solution you'd like
A similar standalone linter, the
lll
linter, offers anexclude
parameter which excludes lines matching a regular expression. If theline-length-limit
rule could offer a similar option to exclude lines based on a regular expression, then we could set it to exclude checking lines with a pattern likego:generate
.Describe alternatives you've considered
Issue #701 proposes a somewhat similar scheme of excluding rules based on whether the filename matches a regular expression. Rather than have a line exclusion specific to line-length-limit, we could allow excluding any rule based on whether the line matches a regular expression. This could be more generic if other rules could benefit from line-regexp-specific exclusions.
Additional context
None
The text was updated successfully, but these errors were encountered: