This repository has been archived by the owner on Apr 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Home
Marco Otte-Witte edited this page Jun 27, 2013
·
28 revisions
Excellent finds the nasty lines in your code. It implements a comprehensive set of checks for possibly buggy parts of your app that would otherwise make it into your repo and eventually to the production server.
Assume you have the following class definition,
class ShoppingBasket < ActiveRecord::Base
def initialize(items = [])
self.items = items
end
end
then Excellent will immediately show you the bad parts about it:
$ excellent shopping_basket.rb
Excellent result:
test.rb
* Line 1: ShoppingBasket does not validate any attributes.
* Line 1: ShoppingBasket defines initialize method.
* Line 1: ShoppingBasket does not specify attr_accessible.
Found 3 warnings.
Excellent has the following checks:
- AbcMetricMethodCheck – reports methods with an ABC metric score that is higher than the threshold.
- AssignmentInConditionalCheck – reports conditionals that test an assignment.
-
CaseMissingElseCheck – reports
case
statements that don’t have anelse
clause. - ClassLineCountCheck – reports classes which have more lines than the threshold.
- ClassNameCheck – reports classes with bad names.
- ControlCouplingCheck – reports methods that check the value of a parameter to decide which execution path to take.
- CyclomaticComplexityBlockCheck – reports blocks with a cyclomatic complexity metric score that is higher than the threshold.
- CyclomaticComplexityMethodCheck – reports methods with a cyclomatic complexity metric score that is higher than the threshold.
-
EmptyRescueBodyCheck – reports empty
rescue
blocks. - FlogBlockCheck – reports blocks with a Flog metric score that is higher than the threshold.
- FlogClassCheck – reports classes with a Flog metric score that is higher than the threshold.
- FlogMethodCheck – reports methods with a Flog metric score that is higher than the threshold.
- ForLoopCheck – reports code that uses for loops.
- MethodLineCountCheck – reports methods which have more lines than the threshold.
- MethodNameCheck – reports methods with bad names.
- ModuleLineCountCheck – reports modules which have more lines than the threshold.
- ModuleNameCheck – reports modules with bad names.
- NestedIteratorsCheck – reports nested iterators.
- ParameterNumberCheck – reports method and blocks that have more parameters than the threshold.
- SingletonVariableCheck – reports class variables.
- GlobalVariableCheck – reports global variables.
Excellent also has some checks specific to Ruby on Rails:
-
AttrAccessibleCheck – reports
ActiveRecord
models that do not specifyattr_accessible
. -
AttrProtectedCheck – reports
ActiveRecord
models that specifyattr_protected
. - InstanceVarInPartialCheck – reports partials that use instance variables.
-
ValidationsCheck – reports
ActiveRecord
models that don’t validate anything. -
CustomInitializeMethodCheck – reports
ActiveRecord
models that define a custominitialize
method. -
ParamsHashInViewCheck – reports views (and partials) that access the
params
hash. -
SessionHashInViewCheck – reports views (and partials) that access the
session
hash.