Class: Simplabs::Excellent::Checks::FlogBlockCheck

Inherits:
FlogCheck
  • Object
show all
Defined in:
lib/simplabs/excellent/checks/flog_block_check.rb

Overview

This check reports blocks with a Flog metric score that is higher than the threshold. The Flog metric is very similar to the cyclomatic complexity measure but also takes Ruby specific statements into account. For example, calls to metaprogramming methods such as define_method or class_eval are weighted higher than regular method calls.

Excellent does not calculate the score exactly the same way as Flog does, so scores may vary. For Flog also see github.com/seattlerb/flog.

Applies to

  • blocks

Constant Summary collapse

DEFAULT_THRESHOLD =
15

Instance Attribute Summary

Attributes inherited from Base

#interesting_files, #interesting_nodes, #warnings

Instance Method Summary collapse

Methods inherited from FlogCheck

#evaluate

Methods inherited from Base

#add_warning, #evaluate_node, #warnings_for

Constructor Details

#initialize(options = {}) ⇒ FlogBlockCheck

:nodoc:



23
24
25
26
# File 'lib/simplabs/excellent/checks/flog_block_check.rb', line 23

def initialize(options = {}) #:nodoc:
  threshold = options[:threshold] || DEFAULT_THRESHOLD
  super([:iter], threshold)
end