Skip to content

Add a configurable Rubydex linter with rule discovery - #974

Merged
st0012 merged 4 commits into
mainfrom
codex/linter-vertical-slice
Aug 6, 2026
Merged

Add a configurable Rubydex linter with rule discovery#974
st0012 merged 4 commits into
mainfrom
codex/linter-vertical-slice

Conversation

@st0012

@st0012 st0012 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Add an in-gem Rubydex::Linter framework and rdx 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.toml settings, skips disabled rules, and warns about configured rules that were not loaded.

@st0012
st0012 requested a review from a team as a code owner August 3, 2026 12:33
@st0012
st0012 marked this pull request as draft August 3, 2026 16:45
@st0012
st0012 force-pushed the codex/diagnostic-severity-related-info branch from 940001d to c18bc7b Compare August 3, 2026 21:27
@st0012
st0012 force-pushed the codex/linter-vertical-slice branch from 95eab7e to 9843962 Compare August 3, 2026 21:28
@st0012
st0012 force-pushed the codex/diagnostic-severity-related-info branch from c18bc7b to f2b40f4 Compare August 4, 2026 12:10
@st0012
st0012 force-pushed the codex/linter-vertical-slice branch from 9843962 to 4120744 Compare August 4, 2026 12:10
@st0012
st0012 force-pushed the codex/diagnostic-severity-related-info branch from f2b40f4 to 70a1b2a Compare August 4, 2026 12:14
@st0012
st0012 force-pushed the codex/linter-vertical-slice branch from 4120744 to 917b40b Compare August 4, 2026 12:14
@st0012
st0012 force-pushed the codex/diagnostic-severity-related-info branch from 70a1b2a to 5f2e517 Compare August 4, 2026 18:05
@st0012
st0012 force-pushed the codex/linter-vertical-slice branch 2 times, most recently from 42a0d0e to 75787e8 Compare August 4, 2026 21:11
@st0012
st0012 marked this pull request as ready for review August 4, 2026 21:29
Comment thread lib/rubydex/cli/command.rb Outdated
@soutaro

soutaro commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

It looks like RuleConfig isn’t consumed by the linter in this PR, and there doesn’t seem to be a standard way for a rule to access its configuration. Is that integration planned for a follow-up PR?

@st0012

st0012 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@soutaro Yes I split the work into multiple small PRs to speed up review

Base automatically changed from codex/diagnostic-severity-related-info to main August 5, 2026 09:23
@st0012
st0012 force-pushed the codex/linter-vertical-slice branch from 75787e8 to 29c1d6f Compare August 5, 2026 10:02
@st0012 st0012 changed the title Add a minimal Rubydex linter Add a configurable Rubydex linter with rule discovery Aug 5, 2026
@st0012

st0012 commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

@soutaro I decided to expand a PR quite a bit so now config and automatic rule loading is part of the PR too.

Comment thread exe/rdx Outdated
Comment thread lib/rubydex/linter/runner.rb Outdated
abort("Unable to load linter rules from #{rule_file}: #{error.message}")
end

Rubydex::Linter::Rule.subclasses - existing_rules

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if someone will one day try to create a custom rule by subclassing another rule? 🤔

@st0012 st0012 Aug 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@st0012 st0012 added the enhancement New feature or request label Aug 5, 2026
@st0012
st0012 requested review from Morriar and soutaro August 5, 2026 21:03
@st0012 st0012 self-assigned this Aug 5, 2026

@alexcrocha alexcrocha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@st0012

st0012 commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

I think there's not a clear answer to it. But I think linter is where we should try surfacing them because:

  • If you think about it, the graph diagnostics are the "rules" we made that we think the codebase should not follow.
  • Among all the tools we've planned so far, linter is the only place that's suitable to surface them.

And if we found these diagnostics noisy later, we can:

  • Review whether our diagnostics make sense at all. Perhaps we can remove some
  • Provide a config to opt out

For now I'll keep them, but it'd be easy to drop as well.

@st0012
st0012 merged commit 7fff427 into main Aug 6, 2026
30 checks passed
@st0012
st0012 deleted the codex/linter-vertical-slice branch August 6, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants