-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Format Ruby #1456
Comments
https://github.com/adamzapasnik/prettier-plugin-erb - might be useful |
Thios has been a trip! Prettier for ruby works really well but it is not in accordance with rubocop. I changed some of the rules but I can't get the two to agree on indentation. Prettier's suggestion is really odd to me and I'm unable to work out what phrase to search for to find out why it would be doing this - the only kind of indentation rules I'm finding are two do with the age old 2 vs 4 spaces battle, nothing about indenting to the starting position of the opening bracket. Given the above I think I might use it for a one off file format, and then run the files through rubocop? This would at least tidy some things up, whilst stopping the two from clashing. What do we think? |
discussed in tech standup - can we just run this on erb files? |
unfortunately the erb arm of this plugin is currently very broken. I've just tried to add it and ran into several problems, then found this: adamzapasnik/prettier-plugin-erb#137 I then tried to find another erb editor and discovered erb-lint, which runs on rubocop - https://github.com/Shopify/erb-lint BUT setting this up has been quite painful. It requires a lot of special config rules to stop rubocop from doing mad things to your erb, because it treats every block as a separate file, for example injecting "frozen string literal" into files thousands of times! I've tried adding config rules to address this (Shopify/erb_lint#222) but it's still introducing lots of changes that just break the erb, like reformatting variable assignation, for example
becomes
which is extremely not helpful! The main thing it does everywhere in spades is reformatting double quotations to single quotations, and it doesn't do any helpful long line or weird space reformatting, although it does tell you about long lines. So, the summary is, this is more work than it's worth to introduce and I'm going to close this now as being thoroughly researched. |
@aaaaargZombies tagging you in case you're interested! |
At least we (you) tried. We will have to continue with our ugly templates. |
User story
As a developer I need to have my Ruby code formatted by a computer so that I know it follows the repository code standards and doesn't have make formatting choices.
Acceptance criteria
Implementation notes & questions
Implementation plan
To be written by the developer
The text was updated successfully, but these errors were encountered: