Sha256: 6794e4dd10e721be79017417966397ec88cf82e093246129cba0da4d37b21afe

Contents?: true

Size: 623 Bytes

Versions: 2

Compression:

Stored size: 623 Bytes

Contents

require 'simplabs/excellent/checks/line_count_check'

module Simplabs

  module Excellent

    module Checks

      class MethodLineCountCheck < LineCountCheck

        DEFAULT_THRESHOLD = 20

        def initialize(options = {})
          threshold = options[:threshold] || DEFAULT_THRESHOLD
          super([:defn], threshold)
        end

        protected

          def node_to_count(node)
            node[3][1]
          end

          def error_args(node, line_count)
            ['Method {{method}} has {{count}} lines.', { :method => node[1], :count => line_count }]
          end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simplabs-excellent-1.0.0 lib/simplabs/excellent/checks/method_line_count_check.rb
simplabs-excellent-1.0.1 lib/simplabs/excellent/checks/method_line_count_check.rb