Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/license_finder/license/definitions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def mpl2

matcher = AnyMatcher.new(
Matcher.from_template(Template.named('MPL2')),
HeaderMatcher.new(Matcher.from_regex(header_regexp))
HeaderMatcher.new(Matcher.from_regex(header_regexp), 3)
)

License.new(
Expand Down
14 changes: 13 additions & 1 deletion spec/lib/license_finder/license/definitions_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -469,9 +469,21 @@
expect(subject).to be_matches_text 'Mozilla Public License, version 2.0'
expect(subject).to be_matches_text 'Mozilla Public Licence version 2.0'

expect(subject).not_to be_matches_text "Something else\nMozilla Public License, version 2.0"
expect(subject).not_to be_matches_text 'Mozilla Public License version 1.1'
end

it 'should return true if the text has a copyright header before the license' do
license_text_with_copyright = <<~TEXT
Copyright (c) 2026 My Company, Inc.

Mozilla Public License, version 2.0
TEXT
expect(subject).to be_matches_text license_text_with_copyright
end

it 'should return true if the license text appears within the first few lines' do
expect(subject).to be_matches_text "Something else\nMozilla Public License, version 2.0"
end
end
end

Expand Down