-
Notifications
You must be signed in to change notification settings - Fork 35
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
ignore directives inconsistency #803
Comments
Hi @nejec, and thanks for filing this issue! There's a couple of things going on here. First of all — that rule is an aggregate rule, but that's clearly missing from the header in the documentation of that rule. Compare to the docs of e.g. impossible-not. Will have that fixed as soon as possible! So what's an aggregate rule, and what makes them special? A section in the README (under the rules table) explains that, but since it wasn't marked as one, it's no wonder that you wouldn't find it!
Since unresolved-import is an aggregate rule — meaning it can never resolve imports with only a single file provided — it is not executed when you run However, the issue you're seeing where the ignore directive isn't honored is certainly a bug, as even the documentation suggests that as a way to have it ignored. I'm a little confused myself about that, as this was a known issue around aggregate rules, as you can read more about in #344. We'll have this fixed in the next release. In the meantime, a configuration file is likely your best option.
Don't do that though! The rule has a special except-imports attribute that'll allow you to list the imports that should be excepted, so there's no need to ignore the rule entirely: .regal/config.yaml rules:
imports:
unresolved-import:
level: error
except-imports:
- data.provider.parameters |
Also some light refactoring, but should hopefully not be too distracting. Fixes #803 Signed-off-by: Anders Eknert <[email protected]>
Also some light refactoring, but should hopefully not be too distracting. Fixes #803 Signed-off-by: Anders Eknert <[email protected]>
Also some light refactoring, but should hopefully not be too distracting. Fixes #803 Signed-off-by: Anders Eknert <[email protected]>
* Support ignore directives in aggregate rules Also some light refactoring, but should hopefully not be too distracting. Fixes #803 Signed-off-by: Anders Eknert <[email protected]> * Return `null` in textDocument/diagnostic handler (#812) While the specification isn't clear here, Neovim apparently had issues dealing with the empty object response. And since all the other editors seem to handle a null response too, let's just go with that instead. Fixes #810 Signed-off-by: Anders Eknert <[email protected]> --------- Signed-off-by: Anders Eknert <[email protected]>
* Support ignore directives in aggregate rules Also some light refactoring, but should hopefully not be too distracting. Fixes StyraInc#803 Signed-off-by: Anders Eknert <[email protected]> * Return `null` in textDocument/diagnostic handler (StyraInc#812) While the specification isn't clear here, Neovim apparently had issues dealing with the empty object response. And since all the other editors seem to handle a null response too, let's just go with that instead. Fixes StyraInc#810 Signed-off-by: Anders Eknert <[email protected]> --------- Signed-off-by: Anders Eknert <[email protected]>
I am a bit puzzled on the configuration of ignored rules. The documentation states that inline directive are the highest and ignoring all rules in the config is the lowest ones.
For now, we were always using
regal
in CI with CLI exclusions (e.g.--disable-rule todo-comments
) and it worked pretty well. However, we wanted to change things around and found out some inconsistencies, which I can't find any explanation for it.Setup
Default regal lint output
Default run of
regal lint
with direct file reference without any configuration:Default run of
regal lint
with directory reference without any configuration:If I run
regal lint
on each file, no issues are detected:Neither of these runs detected inline ignore configuration.
Inconsistency?
Other information:
.regal/config.yaml
and configure theunresolved-import
rule as ignored,$ regal lint opa/
detects the exception and rule does not trigger.Question
I would really prefer the inline ignore directives but I really don't know how to use it, since they do not trigger in any case. So, what am I doing wrong?
The text was updated successfully, but these errors were encountered: