-
Notifications
You must be signed in to change notification settings - Fork 40
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
lsp: Fix inconsistent processing of ignores #1227
lsp: Fix inconsistent processing of ignores #1227
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixing this is great! 👏
Passing URIs to a function that at least judging by its name expects a directory.. doesn't feel great. But your hack for dealing with that is much better than mine!
conf := {"rules": {"test": {"rule": {"level": "error"}}}} | ||
|
||
not config.excluded_file("test", "rule", "file:///workspace/folder/foo/bar/p.rego") with config.merged_config as conf | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not expect these tests to have to be removed, but perhaps moved to the tests of main. Wr could certainly use some coverage here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that 72cc35b is a good improvement here. I've brought back some tests, though they are now in main.rego as config is not meant to know about URIs any more.
I have also renamed the rootDir refs to pathPrefix to make it clearer that we're supporting URI or path prefixes with these.
I would actually like to rename the function as it's being used with URIs elsewhere already and is even mentioned in the comment for the function. I will take another pass at this today. (Update: done, see #1227 (comment)) |
bundle/regal/main/main_test.rego
Outdated
test_exclude_files_rule_config_with_path_prefix_relative_name if { | ||
cfg := {"rules": {"testing": {"test": {"level": "error"}}}} | ||
|
||
# regal ignore:leaked-internal-reference |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you won't be needing this if you rebase from main? :)
In the LS linting, pattern/* would not work when it would in the CLI. This was related to how abs paths were resolved and is fundamentally caused by and issue with URIs being used as file names in the linter. Now, all files from the LS lint are ignored based on their path with the workspace root URI trimmed. Signed-off-by: Charlie Egan <charlie@styra.com>
This is more permissive of a URI prefix than rootDir Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
72cc35b
to
1743325
Compare
* lsp: Fix inconsistent processing of ignores In the LS linting, pattern/* would not work when it would in the CLI. This was related to how abs paths were resolved and is fundamentally caused by and issue with URIs being used as file names in the linter. Now, all files from the LS lint are ignored based on their path with the workspace root URI trimmed. Signed-off-by: Charlie Egan <charlie@styra.com> * Rename rootDir to path prefix This is more permissive of a URI prefix than rootDir Signed-off-by: Charlie Egan <charlie@styra.com> * Remove ignore:leaked-internal-reference comments Signed-off-by: Charlie Egan <charlie@styra.com> --------- Signed-off-by: Charlie Egan <charlie@styra.com>
In the LS linting, pattern/* would not work when it would in the CLI. This was related to how abs paths were resolved and is fundamentally caused by and issue with URIs being used as file names in the linter.
Now, all files from the LS lint are ignored based on their path with the workspace root URI trimmed.
Screen.Recording.2024-10-30.at.15.45.30.mov