Sha256: 3d8b90ca3b9d2b7653a2f6e16c462a8adfd956ab4139fdd7f8dbbf41ea2ab1bd
Contents?: true
Size: 1.15 KB
Versions: 4
Compression:
Stored size: 1.15 KB
Contents
require 'simplabs/excellent/checks/flog_check' module Simplabs module Excellent module Checks # 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 # http://github.com/seattlerb/flog. # # ==== Applies to # # * blocks class FlogBlockCheck < FlogCheck DEFAULT_THRESHOLD = 15 def initialize(options = {}) #:nodoc: threshold = options[:threshold] || DEFAULT_THRESHOLD super([Parsing::BlockContext], threshold) end protected def warning_args(context) #:nodoc: [context, '{{block}} has flog score of {{score}}.', { :block => context.full_name, :score => context.flog_score }] end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems