Sha256: c1547d03d208234ad2b0f80b08d9d5bd9a60c2a5844371d0375d64d3d67d7841

Contents?: true

Size: 466 Bytes

Versions: 72

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # This module encapsulates the ability to allow certain identifiers in a cop.
    module AllowedIdentifiers
      SIGILS = '@$' # if a variable starts with a sigil it will be removed

      def allowed_identifier?(name)
        allowed_identifiers.include?(name.to_s.delete(SIGILS))
      end

      def allowed_identifiers
        cop_config.fetch('AllowedIdentifiers', [])
      end
    end
  end
end

Version data entries

72 entries across 66 versions & 7 rubygems

Version Path
rubocop-1.15.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
cocRb-0.1.0 .bundle/ruby/3.0.0/gems/rubocop-1.14.0/lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.14.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.13.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.12.1 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.12.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.11.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.10.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.9.1 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.9.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.8.1 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.8.0 lib/rubocop/cop/mixin/allowed_identifiers.rb