Sha256: 908af8b9d73ee809f573e3fbe91a264c65b3d709d875ad6a868cdaea9d1aca17
Contents?: true
Size: 903 Bytes
Versions: 1
Compression:
Stored size: 903 Bytes
Contents
module Pelusa module Lint class ManyArguments def initialize @violations = Set.new end def check(klass) iterate_lines!(klass) return SuccessfulAnalysis.new(name) if @violations.empty? FailedAnalysis.new(name, formatted_violations) do |violations| "Methods with more than #{limit} arguments: #{violations.join(', ')}" end end private def name "Methods have short argument lists" end def limit Pelusa.configuration['ManyArguments'].fetch('limit', 3) end def iterate_lines!(klass) ClassAnalyzer.walk(klass) do |node| if node.is_a?(Rubinius::AST::Define) && node.arguments.total_args > limit @violations << node.name end end end def formatted_violations @violations.to_a end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pelusa-0.2.3 | lib/pelusa/lint/many_arguments.rb |