Interesting gems for better code quality
Published on: 21 Jan 2017
While reading through the last 8 issues of Ruby Weekly I had unread in my inbox, I’ve found and tried out some gems that seem interesting and might bring extra input/advice in order to achieve better code style and quality, of which I might be a bit obsessed over.
- Rails Best Practices: after being run on your project root, it will produce an html file with a list of faults found in your code, according to the items detailed here.
- RubyCritic: runs Reek, flay and flog, to produce a site with metrics, graphs and info similar to what you could find on CodeClimate. Really nice. I always have Rubocop integrated with Atom, my $EDITOR of choice, and could do the same with Reek, but the ouput is a bit overwhelming with this one, so it’s better to have it done in a nice site living on the project’s tmp folder.
- Bundler-Audit: this one checks for vulnerabilities in the gems you’ve got on your Gemfile and the sources you use on it.
- Brakeman: this one checks for potential security breaches in your code.
There are also some of them I’d like to try sometime, but need quite more configuration and work:
- Scientist! and Suture are tools for safely refactoring code. We all know the ‘cover with test, then change’ path, but these two might be useful when you’re working on critical parts of the code and you want to be extra-super-sure that everything is all right.
- Coverband is a tool you need run on production, and it measures code usage. This is extremely useful on large production apps to detect conditional paths or methods are never reached, which might allow you to just delete code or rework it.
Any other gem you find useful and want to reccomend? Tell me on twitter!