By using Rails We can explore an endless of tools that We can use a more efficient and quick code. Also, We can find tools that allow us to review our implementation.
There is a lot to be listed and ready to go, but We want to show you which ones are vital for Us here in 4Geeks.
This gem generates a full report about the current quality of our code, by using different gems of analysis like Reek
gem 'rubycritic', require: false
This will generate a HTMl document where We can find the state of our code and also be able to analyse all the smells returned. Here, in 4Geeks this gem is used often to check and confirm that the code written is using the Rails standards and quality.
Rubocop is a gem very interesting, which is a static code analysis, totally based on the ruby style guide
, who is the one that provides all the standards that ruby demands. This gem will show to us a detailed report with all the rule violations that we have in our code, for example: useless variables
or redundant use of ruby methods.
This gem allow us to check in different formats all the results. Starting by checking the code directly in the console, in a JSON file or a HTML document. Here in 4Geeks we enjoy using HTML format that way we can show in a good visual form to the clients or partners all the results of the analysis.
Also Rubocop, bring to us a configuration set, that way We can be able to modify some alerts if We think It’s not necessary to follow some ruby style guide rule, so, our teams follow their own rules in that scenario.
We highly recommend to run this gem before send you code to review, so, you can confirm that everything you wrote is under the standards of your team and ruby.
gem 'rubocop', require: false
$ rubocop --format html -o rubocop.html
This gem is very important, because it show us a complete analysis of possible failures in our code security. It shows the results by classifying them by level: High, Medium, Low. Thanks to that we can decide where to check first. We have to take in consideration that by fixing this stuff won’t assure total security, but it will very helpful to determine certain errors.
gem 'brakeman', require: false
$ brakeman -o output.html
We went through the most known gems in code analysis, as we saw, We can use them to reduce code smells and increase code security. Now, We have to explore other options We can not delimited our selves and our projects to use only those tools, there are a lot of options around internet and also, We can think about build one, why not ?
Founded in 2012 by Allan Porras,
4Geeks is a global revenue growth firm for Fortune 500, Global 2000 and fast-growing SMBs.
Provides software and
data-driven growth hacking solutions, to
clients in multiples
industries including eCommerce,
Retail, Healthtech, Banking & Fintech, Startups & B2B SaaS, Marketing and Real Estate.
-> Contact sales