Skip to content

Commit

Permalink
fixing some reek warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
arwagner committed Nov 6, 2011
1 parent dd32054 commit 149649f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/reek/smells/uncommunicative_module_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ def initialize(source, config = UncommunicativeModuleName.default_config)
#
# @return [Array<SmellWarning>]
#
# :reek:Duplication { allow_calls: [ to_s ] }
def examine_context(ctx)
@reject_names = value(REJECT_KEY, ctx, DEFAULT_REJECT_SET)
@accept_names = value(ACCEPT_KEY, ctx, DEFAULT_ACCEPT_SET)
name = ctx.exp.simple_name
return [] if @accept_names.include?(ctx.full_name)
exp = ctx.exp
full_name = ctx.full_name
name = exp.simple_name
return [] if @accept_names.include?(full_name)
var = name.to_s.gsub(/^[@\*\&]*/, '')
return [] if @accept_names.include?(var)
return [] unless @reject_names.detect {|patt| patt === var}
smell = SmellWarning.new(SMELL_CLASS, ctx.full_name, [ctx.exp.line],
smell = SmellWarning.new(SMELL_CLASS, full_name, [exp.line],
"has the name '#{name}'",
@source, SMELL_SUBCLASS, {MODULE_NAME_KEY => name.to_s})
[smell]
Expand Down

0 comments on commit 149649f

Please sign in to comment.