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
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_identifiers.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_identifiers.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/rubocop-1.26.0/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.35.1/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.26.0/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.36.0/lib/rubocop/cop/mixin/allowed_identifiers.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/rubocop-1.31.2/lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.40.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.39.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.38.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.37.1 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.37.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.36.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.35.1 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.35.0 lib/rubocop/cop/mixin/allowed_identifiers.rb
rubocop-1.34.1 lib/rubocop/cop/mixin/allowed_identifiers.rb