lib/pelusa/lint/properties.rb in pelusa-0.2.2 vs lib/pelusa/lint/properties.rb in pelusa-0.2.3
- old
+ new
@@ -4,11 +4,10 @@
def initialize
@violations = Set.new
end
def check(klass)
- initialize
iterate_lines!(klass)
return SuccessfulAnalysis.new(name) if @violations.empty?
FailedAnalysis.new(name, @violations) do |violations|
@@ -21,17 +20,16 @@
def name
"Doesn't use getters, setters or properties"
end
def iterate_lines!(klass)
- iterator = Iterator.new do |node|
+ ClassAnalyzer.walk(klass) do |node|
if node.is_a?(Rubinius::AST::Send)
if [:attr_accessor, :attr_writer, :attr_reader].include? node.name
@violations << node.line
end
end
end
- Array(klass).each(&iterator)
end
end
end
end