Sha256: e5e8ef073b23668aacde63d809d0b2dfc28e83469de49e3ecf6a9520de1318cf
Contents?: true
Size: 970 Bytes
Versions: 1
Compression:
Stored size: 970 Bytes
Contents
require 'simplabs/excellent/checks/base' module Simplabs module Excellent module Checks # This check reports methods that check the value of a parameter to decide which execution path to take. Control Coupling introduces a # dependency between the caller and the callee. Any changes to the possible values of the parameter must be reflected at the caller side # as well as at the called method. # # ==== Applies to # # * methods class ControlCouplingCheck < Base def initialize #:nodoc: super @interesting_contexts = [Parsing::IfContext, Parsing::CaseContext] end def evaluate(context) #:nodoc: if tested_parameter = context.tests_parameter? add_warning(context, '{{method}} is coupled to {{argument}}.', { :method => context.parent.full_name, :argument => tested_parameter.to_s }, -2) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
excellent-1.6.0 | lib/simplabs/excellent/checks/control_coupling_check.rb |