Add a configurable Rubydex linter with rule discovery - #974
Conversation
940001d to
c18bc7b
Compare
95eab7e to
9843962
Compare
c18bc7b to
f2b40f4
Compare
9843962 to
4120744
Compare
f2b40f4 to
70a1b2a
Compare
4120744 to
917b40b
Compare
70a1b2a to
5f2e517
Compare
42a0d0e to
75787e8
Compare
|
It looks like |
|
@soutaro Yes I split the work into multiple small PRs to speed up review |
75787e8 to
29c1d6f
Compare
|
@soutaro I decided to expand a PR quite a bit so now config and automatic rule loading is part of the PR too. |
| abort("Unable to load linter rules from #{rule_file}: #{error.message}") | ||
| end | ||
|
|
||
| Rubydex::Linter::Rule.subclasses - existing_rules |
There was a problem hiding this comment.
I wonder if someone will one day try to create a custom rule by subclassing another rule? 🤔
There was a problem hiding this comment.
The linter in Core currently does this as well as we haven't seen a need to create abstract rule classes. I think we can design this later and finish the porting first. Will create an issue for this.
Issue: #984
alexcrocha
left a comment
There was a problem hiding this comment.
Both the rule discovery and config wiring look good to me 👍
I do have a question about merging the graph diagnostics with the rule diagnostics, mostly to shape my mental model on the concepts of linting rules and diagnostics. I know for the output they're both diagnostics, but are they the same concept that surfacing both through the linter is the natural output?
|
I think there's not a clear answer to it. But I think linter is where we should try surfacing them because:
And if we found these diagnostics noisy later, we can:
For now I'll keep them, but it'd be easy to drop as well. |
Add an in-gem
Rubydex::Linterframework andrdx lint [PATH]for running semantic rules against a workspace. The runner combines native and rule diagnostics, preserves related information, produces deterministic output, and fails only for error diagnostics.The command discovers rules from the workspace and active Bundler dependencies, applies
rubydex.tomlsettings, skips disabled rules, and warns about configured rules that were not loaded.