Add Papyrus and GAP grammars to whitelist

This commit is contained in:
Paul Chaignon
2015-02-09 21:29:53 +01:00
parent 0019abe5e7
commit 11f7e6e1b4

View File

@@ -3,12 +3,16 @@ require_relative "./helper"
class TestGrammars < Minitest::Test class TestGrammars < Minitest::Test
ROOT = File.expand_path("../..", __FILE__) ROOT = File.expand_path("../..", __FILE__)
# These grammars have no license but have been grandfathered in. New grammars LICENSE_WHITELIST = [
# must have a license that allows redistribution. # This grammar's MIT license is inside a subdirectory.
UNLICENSED_GRAMMARS_WHITELIST = %w[ "vendor/grammars/SublimePapyrus",
vendor/grammars/Sublime-Lasso "vendor/grammars/gap-tmbundle",
vendor/grammars/Sublime-REBOL
vendor/grammars/x86-assembly-textmate-bundle # These grammars have no license but have been grandfathered in. New grammars
# must have a license that allows redistribution.
"vendor/grammars/Sublime-Lasso",
"vendor/grammars/Sublime-REBOL",
"vendor/grammars/x86-assembly-textmate-bundle",
].freeze ].freeze
def setup def setup
@@ -77,9 +81,9 @@ class TestGrammars < Minitest::Test
unlicensed = categories[:unlicensed] || [] unlicensed = categories[:unlicensed] || []
unrecognized = categories[:unrecognized] || [] unrecognized = categories[:unrecognized] || []
disallowed_unlicensed = unlicensed - UNLICENSED_GRAMMARS_WHITELIST disallowed_unlicensed = unlicensed - LICENSE_WHITELIST
disallowed_unrecognized = unrecognized - UNLICENSED_GRAMMARS_WHITELIST disallowed_unrecognized = unrecognized - LICENSE_WHITELIST
extra_whitelist_entries = UNLICENSED_GRAMMARS_WHITELIST - (unlicensed | unrecognized) extra_whitelist_entries = LICENSE_WHITELIST - (unlicensed | unrecognized)
message = "" message = ""
if disallowed_unlicensed.any? if disallowed_unlicensed.any?
@@ -93,7 +97,7 @@ class TestGrammars < Minitest::Test
end end
if extra_whitelist_entries.any? if extra_whitelist_entries.any?
message << "\n\n" unless message.empty? message << "\n\n" unless message.empty?
message << "The following grammar submodules are listed in UNLICENSED_GRAMMARS_WHITELIST but either have a license (yay!)\n" message << "The following grammar submodules are listed in LICENSE_WHITELIST but either have a license (yay!)\n"
message << "or have been removed from the repository. Please remove them from the whitelist.\n" message << "or have been removed from the repository. Please remove them from the whitelist.\n"
message << extra_whitelist_entries.sort.join("\n") message << extra_whitelist_entries.sort.join("\n")
end end