Sha256: cfec38f32b0b8b0347cf80b7d9b36c6688d7173966f8babe96ad0c00c061fcb4

Contents?: true

Size: 547 Bytes

Versions: 2

Compression:

Stored size: 547 Bytes

Contents

# encoding=utf-8
module Licensee
  module Matchers
    class Copyright
      # rubocop:disable Metrics/LineLength
      REGEX = /\s*(Copyright|\(c\)) (©|\(c\)|\xC2\xA9)? ?(\d{4}|\[year\])(.*)?\s*/i

      def initialize(file)
        @file = file
      end

      def match
        # Note: must use content, and not content_normalized here
        if @file.content.strip =~ /\A#{REGEX}\z/i
          Licensee::License.find('no-license')
        end
      rescue
        nil
      end

      def confidence
        100
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licensee-8.5.0 lib/licensee/matchers/copyright_matcher.rb
licensee-8.4.0 lib/licensee/matchers/copyright_matcher.rb