Sha256: b384a20ef2aa875455a5608753c65c9e53205df2972883ed67d9ab97b6b4c70d
Contents?: true
Size: 866 Bytes
Versions: 7
Compression:
Stored size: 866 Bytes
Contents
module Pelusa module Lint class Properties 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| "There are getters, setters or properties in lines #{violations.to_a.join(', ')}" end end private def name "Doesn't use getters, setters or properties" end def iterate_lines!(klass) iterator = Iterator.new 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
Version data entries
7 entries across 7 versions & 1 rubygems