Sha256: b1f2b8f1e51e9f21987b410296b66b79b25599cff988e7f139932701e53860ed

Contents?: true

Size: 572 Bytes

Versions: 3

Compression:

Stored size: 572 Bytes

Contents

# encoding=utf-8
module Licensee
  module Matchers
    class Copyright
      attr_reader :file

      # 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

3 entries across 3 versions & 1 rubygems

Version Path
licensee-8.7.0 lib/licensee/matchers/copyright_matcher.rb
licensee-8.6.1 lib/licensee/matchers/copyright_matcher.rb
licensee-8.6.0 lib/licensee/matchers/copyright_matcher.rb