Sha256: 263aafeac659318566558a49d84c43af577315413f80ec6c7a0044b8bec9f6ea

Contents?: true

Size: 859 Bytes

Versions: 4

Compression:

Stored size: 859 Bytes

Contents

require 'simplabs/excellent/checks/line_count_check'

module Simplabs

  module Excellent

    module Checks

      # This check reports modules which have more lines than the threshold. Modules with a large number of lines are hard to read and understand
      # and often an indicator for badly designed code as well.
      #
      # ==== Applies to
      #
      # * modules
      class ModuleLineCountCheck < LineCountCheck

        DEFAULT_THRESHOLD = 300

        def initialize(options = {}) #:nodoc:
          options[:threshold] ||= DEFAULT_THRESHOLD
          super([Parsing::ModuleContext], options)
        end

        protected

          def warning_args(context) #:nodoc:
            [context, '{{module}} has {{count}} lines.', { :module => context.full_name, :count => context.line_count + 1 }]
          end

      end

    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
excellent-2.1.1 lib/simplabs/excellent/checks/module_line_count_check.rb
excellent-2.1.0 lib/simplabs/excellent/checks/module_line_count_check.rb
excellent-2.0.1 lib/simplabs/excellent/checks/module_line_count_check.rb
excellent-2.0.0 lib/simplabs/excellent/checks/module_line_count_check.rb