Skip to content
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

Line numbers are inconsistent and are affected by whitespace and comments in the file #373

Open
fnimick opened this issue Aug 28, 2024 · 0 comments
Labels

Comments

@fnimick
Copy link

fnimick commented Aug 28, 2024

This causes issues with integration into other tools (such as an in-editor linter) since it doesn't line up with the actual code.

Examples:

create table test_table (
    test_column varchar(255)
);

This is fine, squawk reports: test.sql:1:0: warning: prefer-text-field...

However, when I add a blank line before this:

<blank>
create table test_table (
    test_column varchar(255)
);

This is now reported as test.sql:1:1: ... - should be 2:0, but is instead line 1, column 1.

If I add a comment to the blank line:

-- foo
create table test_table (
    test_column varchar(255)
);

Now it's reported as test.sql:1:0 - line 1, column 0 again, where it should be 2:0. Any amount of whitespace between the comment and the statement has no effect.

For the final example:

-- foo

select foobar;

create table test_table (
    test_column varchar(255)
);

This reports on test.sql:4:2. Adding whitespace between the comment and the select increments the reported error row, and adding whitespace between the select and the create table statement increments the reported error column. e.g.

-- foo


select foobar;



create table test_table (
    test_column varchar(255)
);

reports on test.sql:5:4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants