0.0
No commit activity in last 3 years
No release in over 3 years
The tool detects code's flaw, which should be fixed, with static analysis of RubyVM bytecode. Therefore, it works for only ruby 1.9.x or 2.0.x .
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

>= 0
 Project Readme

FlawDetector Build Status

FlawDetector is a tool to detect ruby code's flaw with static analysis. In static analysis, it analyze RubyVM bytecode which is compiled from ruby code.

FlawDetector is similer to FindBugs which is a tool to detect java code's flaw. For details of FindBugs, refer to references section in this text file.

Getting Started

$ gem install flaw_detector

Usage

  flaw_detector [-f outfille] [--help] rbfile ...

Example

$ flaw_detector -f result.csv sample/flaw_in_code.rb

Command Result

Currently, FlawDetector supports only CSV format result. Result example is as follows:

$ cat result.csv
msgid,file,line,short_desc,long_desc,details
RCN_REDUNDANT_FALSECHECK_OF_FALSE_VALUE,sample/flaw_in_code.rb,4,Redundant falsecheck of value known to be false,Redundant falsecheck of a which is known to be false in LINE:2,This method contains a redundant check of a known false value against the constant false.
NP_ALWAYS_FALSE,sample/flaw_in_code.rb,7,False value missing method received,False value missing method received in a,"A false value, which is NilClass or FalseClass, is received missing method here. This will lead to a NoMethodError when the code is executed."

Each line represents a flaw. If you want to know how flaw can be shown in result, refer to message.rb

Fix and Recheck

According to the result, you should fix source code and recheck it by FlawDetector until "OK" is displaied

$ emacs sample/flaw_in_code.rb
$ cat sample/flaw_in_code.rb
def no_flaw(a)
  if a
    rl = a + 1
  else
    rl = a.to_i + 1
  end
end
$ flaw_detector sample/flaw_in_code.rb
OK
$

References