Sha256: a81ce015ce552f96c76076743da82575fd8a0a5a6e8668401dbc22f51b5dbb34

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

require 'simplabs/excellent/checks/base'

module Simplabs

  module Excellent

    module Checks

      class NameCheck < Base #:nodoc:

        def initialize(interesting_contexts, options = {}) #:nodoc:
          super(options)
          @interesting_contexts = interesting_contexts
          @pattern              = Regexp.new(options[:pattern].to_s)
          @whitelist            = Array(options[:whitelist])
        end

        def evaluate(context)
          name = context.name.to_s
          if !@whitelist.include?(name) && !(name =~ @pattern)
            add_warning(*warning_args(context))
          end
        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/name_check.rb
excellent-2.1.0 lib/simplabs/excellent/checks/name_check.rb
excellent-2.0.1 lib/simplabs/excellent/checks/name_check.rb
excellent-2.0.0 lib/simplabs/excellent/checks/name_check.rb