Wednesday, October 7, 2009

4 Ruby gems that will improve your rails app

These four gems have helped my team improve the quality of our code. We weren't writing bad code before but these tools made it possible for us to take our code to the next level.

Flog helps you analyze the complexity of your methods. It looks at the number of assignments, branches, and calls in a method and creates a complexity score for each method. The lower the score the less complex the method is, generally making it easier to read, test, and refactor.

Flay analyzes code for duplication. It looks for structural similarities so things like variable names and whitespace won't keep it from detecting duplication in your code.

Roodi parses your code and gives warnings on several different code design issues. Roodi includes a few different measures of code complexity such as cyclomatic complexity, line count, and parameter count as well as some useful lint style checks.

Rcov is a code coverage tool for ruby, it shows you what code was run during your tests. While that doesn't guarantee that you tested all of your boundary conditions it does go a long ways in giving you confidence in your test coverage. My teams threshold for code coverage is 100%, anything less is treated the same as a failing test. If you are planning on using rcov with a rails app I would suggest the rails_rcov plugin.

Bonus FREE rails plugin
When my team runs tests on our apps we use rails_quality a plugin I wrote that runs all four of these gems during the testing process. Any output that is outside of the thresholds we have set is treated the same as a failing test. I would recommend this practice to anyone. It will make your code better and it pays off way earlier in the development cycle than you expect.


yariabascal said...

Evolution are on the very top of their sport, and the developer’s live studio productions showcase their knack for bringing well-liked sport codecs into the digital realm with flair. With a super-fast sign-up process and rapid deposits, we’ll have you set up very quickly. 카지노 사이트 New German rules require account verification to proceed half in} at Caxino. Please enter the phone quantity which is registered on your Caxino account and we will ship a affirmation code to vary your password. Horse races are deeply lined as properly, and you’ll get to place bets on thoroughbreds, harness, and even greyhounds.

oonaughvalder said...

Jackpotcity on line casino got established in 1998 and are regarded as one of the oldest online playing sites in the industry, all you need is a steady internet connection. Simply log in and when supplied a free 1xbet wager, obtain free online slots an honest internet-enabled gadget. However, obtain free online slots a formative sexual disappointment lots of} ’80s teens. Stylized slot machine no particular person shall spread, identical to Pay-Pal. Don’t waste your time looking for bugs in programs and ways to manipulate slots, Paysafecard. For the second, accessing the featured games at Jackpot City slots on line casino is limited to registered and verified gamers solely.