Sha256: aabbfb75a420d3ecf3607a05f90bea391a57f2c53eba5a498d1043aff0113394

Contents?: true

Size: 874 Bytes

Versions: 12

Compression:

Stored size: 874 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      # This check reports modules with bad names. Badly named modules make reading and understanding the code much harder. Module names regarded as bad
      # are for example:
      #
      # * names that are not Pascal cased (camel cased, starting with an upper case letter)
      #
      # ==== Applies to
      #
      # * modules
      class ModuleNameCheck < NameCheck

        DEFAULT_PATTERN = /^[A-Z][a-zA-Z0-9]*$/

        def initialize(options = {}) #:nodoc:
          pattern = options['pattern'] || DEFAULT_PATTERN
          super([:module], pattern)
        end

        protected

          def warning_args(context) #:nodoc:
            [context, 'Bad module name {{module}}.', { :module => context.full_name }]
          end

      end

    end

  end

end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
simplabs-excellent-1.2.1 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.2.2 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.3.0 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.3.1 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.4.0 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.4.1 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.4.2 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.5.0 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.5.1 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.5.2 lib/simplabs/excellent/checks/module_name_check.rb
simplabs-excellent-1.5.3 lib/simplabs/excellent/checks/module_name_check.rb
excellent-1.5.4 lib/simplabs/excellent/checks/module_name_check.rb