vala-lint icon indicating copy to clipboard operation
vala-lint copied to clipboard

space-before-paren returning incorrect column

Open ChildishGiant opened this issue 3 years ago • 3 comments

This issue was found in https://github.com/vala-lang/vala-lint/pull/146#issuecomment-930781422 but I thought I'd file it separately. The following code should have the same column for each error but the first one always returns off by one.

func1()
func2()
func3()

Output:

1.6     error   Expected space before paren                     space-before-paren
2.5     error   Expected space before paren                     space-before-paren
3.5     error   Expected space before paren                     space-before-paren

ChildishGiant avatar Nov 08 '21 16:11 ChildishGiant

This is the code causing this:

https://github.com/vala-lang/vala-lint/blob/2db018056befba76136e6c69a78d905a128a6165/lib/Utils.vala#L91-L93

We are adding 1 to the column number if the error is on the first line (line_count == 0). I don't know why.

dar5hak avatar Nov 21 '21 17:11 dar5hak

Do @pantor or @jeremypw know why this is there?

ChildishGiant avatar Nov 21 '21 19:11 ChildishGiant

Not sure why. These lines are from a @pantor commit.

jeremypw avatar Nov 22 '21 13:11 jeremypw