Skip to content

Commit

Permalink
Merge pull request #59 from librariesio/mellisio/spdx/add-plus-expres…
Browse files Browse the repository at this point in the history
…sions
  • Loading branch information
Matt Ellis authored May 13, 2020
2 parents 037a403 + 38e32fe commit 613958f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/spdx/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Spdx
VERSION = "2.0.5"
VERSION = "2.0.6"
end
2 changes: 1 addition & 1 deletion lib/spdx_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class SpdxParser
Treetop.load(File.expand_path(File.join(File.dirname(__FILE__), "spdx_parser.treetop")))

SKIP_PARENS = ["NONE", "NOASSERTION", ""]
SKIP_PARENS = ["NONE", "NOASSERTION", ""].freeze
@parser = SpdxGrammarParser.new

def self.parse(data)
Expand Down
2 changes: 1 addition & 1 deletion lib/spdx_parser.treetop
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ grammar SpdxGrammar
end

rule license
[a-zA-Z0-9\-\+:\.]+ &{|seq| Spdx.license_exists?(seq.first.text_value) } <License>
[a-zA-Z0-9\-\+:\.]+ &{|seq| Spdx.license_exists?(seq.first.text_value) || Spdx.license_exists?(seq.first.text_value.delete_suffix('+')) } <License>
end

rule license_exception
Expand Down
3 changes: 3 additions & 0 deletions spec/spdx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
expect(Spdx.valid_spdx?("NOASSERTION")).to be true
expect(Spdx.valid_spdx?("MIT OR NONE")).to be false
end
it "returns true for + expression" do
expect(Spdx.valid_spdx?("AGPL-1.0+"))
end
end
end
context "alias lookup" do
Expand Down

0 comments on commit 613958f

Please sign in to comment.