-
-
Notifications
You must be signed in to change notification settings - Fork 246
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
Make standardrb and rubocop work better in the same project #1249
Comments
Perhaps the typescript pack could be of inspiration to fix this problem |
@Uzaaft can you be more specific? I'm not super familiar with this setup stuff, just pretty basic config stuff. |
Just looked at this, rubycop is not in the pack, nor anything in astrocommunity, so this isnt a bug in astrocommunity more as a collision in your project |
@Uzaaft its a fresh rails 7 project with a fresh astronvim config with only the ruby pack installed. Surely in that case it must mean there’s an issue with how the pack is setup as it seems to use both linting rules instead of choosing only one to use |
Is astro running the rubycop linter? |
Checklist
repro.lua
provided belowNeovim version (nvim -v)
0.10.1
Operating system/version
macOS 14.7
Terminal/GUI
iTerm2
Describe the bug
When using the ruby language pack, standardrb and rubocop conflict with one another.
For example, I'll get a lint warning from standardrb saying not to use spaces inside array brackets, I'll run the formatter to fix this, then I'll get a linting warning from rubocop saying I need to have spaces inside array brackets.
This is in a fresh rails 7 project that comes with rubocop config already setup. I do not have rubocop installed in mason either. I haven't configured rubocop or standardrb myself and I was under the impression standardrb is built on top of rubocop so should be compatible with it.
I created a solargraph-config.yml and in that I silenced the rubocop reporter, but then the issue I had was when pushing commits in my rails project to github, the preconfigured github ci process that comes with rails would fail due to the rubocop linting errors. I could disable the preconfigured ci step, but I figured I'd rather not go against the rails grain so instead I copied the contents of
lua/astrocommunity/pack/ruby/init.lua
into my own config file replacing every instance of"standardrb"
with"rubocop"
. I now no longer get conflicting linting and the formatter goes off of rubocop rather than standardrb.This may become an issue again if ever go to work in a ruby/rails repo that does use standardrb though. I may find myself having to change my nvim config every time I work in a repo that uses the other linter/formatter.
I'm wondering if there's a better way this pack could be designed? Perhaps one where both standardrb and rubocop are included with the ruby pack, but only standardrb is used for linting and formatting if there's a standardrb config file in the repo or only rubocop is used in any other case? Or is my limited knowledge of the ruby toolset the problem, and perhaps I'm actually supposed to do some more of this setup myself? I would've thought the pack would be set and forget though.
Steps to Reproduce
arr = [ 1, 2, 3 ]
gl
to display the lint warnings on the line. Note the warning from standardrbStandard Ruby: Layout/SpaceInsideArrayLiteralBrackets: Do not use space inside array brackets.
<Leader>lf
, or just removing the spaces manuallygl
to display the lint warnings on the line. Note the warning from rubocoprubocop: Use space inside array brackets.
Expected behavior
There should be no conflicting linting warnings. Ideally neovim should be able to determine which linter to use based solely off whether there's a config file for that linter in the project and if not, should default to using only one of the tools.
Screenshots
No response
Additional Context
No response
Minimal configuration
The text was updated successfully, but these errors were encountered: