Sha256: 251c9f87a6bdfed570ddd48ae267f43360d1e457d8d98254c7578151092d5000

Contents?: true

Size: 694 Bytes

Versions: 6955

Compression:

Stored size: 694 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # This module encapsulates the ability to ignore certain lines when
    # parsing.
    module IgnoredPattern
      private

      def ignored_line?(line)
        line = if line.respond_to?(:source_line)
                 line.source_line
               elsif line.respond_to?(:node)
                 line.node.source_range.source_line
               end

        matches_ignored_pattern?(line)
      end

      def matches_ignored_pattern?(line)
        ignored_patterns.any? { |pattern| Regexp.new(pattern).match(line) }
      end

      def ignored_patterns
        cop_config['IgnoredPatterns'] || []
      end
    end
  end
end

Version data entries

6,955 entries across 6,930 versions & 28 rubygems

Version Path
ory-client-0.0.1.alpha106 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-hydra-client-1.11.6 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-keto-client-0.8.0.alpha1 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha105 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha104 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha103 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-hydra-client-1.11.5 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha101 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha100 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-hydra-client-1.11.4 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha99 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha98 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha97 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha96 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha95 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha94 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha93 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha92 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-oathkeeper-client-0.38.20.beta1 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb
ory-client-0.0.1.alpha91 vendor/bundle/ruby/2.5.0/gems/rubocop-0.66.0/lib/rubocop/cop/mixin/ignored_pattern.rb