diff --git a/lib/licensee/matchers/copyright_matcher.rb b/lib/licensee/matchers/copyright_matcher.rb index 024950b..6fe8912 100644 --- a/lib/licensee/matchers/copyright_matcher.rb +++ b/lib/licensee/matchers/copyright_matcher.rb @@ -1,10 +1,10 @@ class Licensee class CopyrightMatcher < Matcher - REGEX = /\A(Copyright )?(©|\(c\)) \d{4}(.*)\n?\z/i + REGEX = /\A(Copyright|Copyright ©|Copyright \(c\)) \d{4}.*?\n?\z/i def match - no_license if file.content_normalized =~ REGEX + no_license if file.content.strip =~ REGEX end def confidence diff --git a/test/test_licensee_copyright_matcher.rb b/test/test_licensee_copyright_matcher.rb index ddb65c0..2fd38ae 100644 --- a/test/test_licensee_copyright_matcher.rb +++ b/test/test_licensee_copyright_matcher.rb @@ -16,15 +16,15 @@ class TestLicenseeCopyrightMatcher < Minitest::Test assert_equal 100, Licensee::CopyrightMatcher.new(@file).confidence end - should "match (C) copyright notices" do - text = "(C) 2015 Ben Balter" + should "match Copyright (C) copyright notices" do + text = "Copyright (C) 2015 Ben Balter" blob = FakeBlob.new(text) file = Licensee::LicenseFile.new(blob) assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key end - should "match © copyright notices" do - text = "© 2015 Ben Balter" + should "match Copyright © copyright notices" do + text = "copyright © 2015 Ben Balter" blob = FakeBlob.new(text) file = Licensee::LicenseFile.new(blob) assert_equal "no-license", Licensee::CopyrightMatcher.match(file).key