When I was using C# and Perl, I automatically checked the code with StyleCop, FxCop, Perl::Critic, Perlty, etc.
Do Ruby and Rails have similar tools?
I searched on Google, but I couldn't find a tool.
Note: This question is a transcription of a previously posted question in English. https://stackoverflow.com/questions/9103874/coding-style-checker-or-code-formatter-for-ruby-rails
ruby ruby-on-rails
IDE IntelliJ (RubyMine) allows you to view coding style issues in the editor.
For projects on GitHub, HoundCI is easy.If you submit a Pull Request normally, you will leave a comment on GitHub about the coding style issues as follows:
HoundCI uses RuboCop as its style checker.So the check items are basically the same as RuboCop
.One caveat is that the HoundCI coding convention is slightly different from the RuboCop default setting.For example:
"foobar"
characters that do not have expression extensions such as "foobar"
should be written."foobar"
.This is the coding convention for thoughbot that provides the HoundCI.
Sign up for online services to automatically check and report code that is not limited to simple formatting. Rubocop is also used internally, but it is easy because it does not require setup.
There is a service called sideCI that checks security checks and Rails-best-practice to see if the gem is out of date. It works with Github, so you can watch it at Pullreq timing.It's free for now.
Also, I recommend a gem that only checks the rubocop with the modified rubocop-git
If you use guard, you can pick up execution errors in real time.Of course, syntax is also.
I will post an article that I have used as a reference online.
Use the Guardgem to detect file changes and perform any task automatically
© 2024 OneMinuteCode. All rights reserved.