walle / lll

Line length linter
MIT License
65 stars 9 forks source link

Line reporting off-by-one #5

Closed JeanMertz closed 5 years ago

JeanMertz commented 6 years ago

Running this on a piece of code:

$ lll -g -l 100 main_test.go

main_test.go:194: line is 104 characters
main_test.go:211: line is 123 characters
main_test.go:215: line is 149 characters
main_test.go:216: line is 149 characters
main_test.go:217: line is 149 characters
main_test.go:219: line is 117 characters
main_test.go:243: line is 155 characters
main_test.go:256: line is 128 characters

Running the same, but now excluding anything starting with func:

$ lll -e func -g -l 100 main_test.go
main_test.go:210: line is 123 characters
main_test.go:214: line is 149 characters
main_test.go:215: line is 149 characters
main_test.go:216: line is 149 characters
main_test.go:218: line is 117 characters
main_test.go:242: line is 155 characters
main_test.go:255: line is 128 characters

The first report (line 194) is now properly skipped, but all other lines now have an off-by-one issue, where previously line 211 was reported to have 123 characters (which is correct), but now the report says that line is on line 210, which is incorrect.

walle commented 5 years ago

I thanks for reporting this. And sorry for taking so long to react to it. I have merged your PR(https://github.com/walle/lll/pull/6) as part of the v1.0.0 release.

Thanks again!