I decided to flog it and I came across Ryan Davis's flog tool.
What is Flog?
It's a tool, which helps you in finding complex areas of your code. More complex code tells you the chances of more bugs. Flog has some smart algorithm which go to methods of a file and gives points to each command/statement of that method. Say, if..else has 5 points, variable declaration has 1 point etc. So if your methods scores more means they are more complex.
How to do it?
Since I am working on windows(don't ask me why :) ), it took me some time to find how to use this tool. After a little hassle I found it and here I am showing the same, just like A, B, C. if you know a better way to do it, please do add your suggestions and comments.
Step A: Install flog as a gem.
Open command prompt:
c:/>gem install flog
Step B: Go to your project folder.
c:\>cd my_project
Step C: Just flog it!!!
- To get all the flog options:
c:\my_project>flog -h
flog options dirs_or_files -a display all flog results, not top 60%
-h display help -I=path extend $LOAD_PATH with path
-s display total score only -v verbosely display progress and errors
- If you want to flog all controllers, following will flog all the *.rb files in your apps\controllers folder:
- To flog controllers, models, helpers and libraries, together:

0 comments:
Post a Comment