Sha256: 19a370c8e23ab76ff2dd83097e259b57cbec27319b6494b53d572488fd9802af

Contents?: true

Size: 493 Bytes

Versions: 6

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

module Licensee
  module Matchers
    class Spdx < Licensee::Matchers::Package
      # While we could parse the LICENSE.spdx file, prefer
      # a lenient regex for speed and security. Moar parsing moar problems.
      LICENSE_REGEX = /PackageLicenseDeclared:\s*([a-z\-0-9. +()]+)\s*/i.freeze

      private

      def license_property
        match = @file.content.match LICENSE_REGEX
        match[1].downcase if match && match[1]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
licensee-9.16.0 lib/licensee/matchers/spdx.rb
licensee-9.15.3 lib/licensee/matchers/spdx.rb
licensee-9.15.2 lib/licensee/matchers/spdx.rb
licensee-9.15.1 lib/licensee/matchers/spdx.rb
licensee-9.15.0 lib/licensee/matchers/spdx.rb
licensee-9.14.1 lib/licensee/matchers/spdx.rb