licensee 9.17.1 → 9.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 00e6cf6abd7d331e0ef90b23896aa31b7da46df2dd0b05473b3ff95aa1fbae02
4
- data.tar.gz: 5dbf325ff4a9f1f92f8841af4902cec2df599411ce036d2bd55ebc200534f99f
3
+ metadata.gz: 224c5413c75e78cad466f9d41b8a18a8b0a7ddf348740521ed37dbea4e25e674
4
+ data.tar.gz: f73bde77074c0e4feff4190551effbaebd685abf539b944ed0509231090fe8be
5
5
  SHA512:
6
- metadata.gz: 8139ba1822c008ac4200b4fde9f3240e85b5210017f032b70781c3407537268a40f5c81ddfa0dbcd8d6202c39f785a4c36128d49aee626664b84525c22e8385f
7
- data.tar.gz: f93f0a52091ec71e002d20105e9bd82144247720578c35801ec573ead17923e546a82a60c57f6f617bbf9f6037f1417d535d0e443ee3d2a4f51b1c01907dd62e
6
+ metadata.gz: 75680afe6a50966f190c3748130cfb72b4b4d68a846aec482405e14756a9d1211754b1a94328e79f38619dc3ee3c1999490b9cab157fc7b76b8cc03661316a7b
7
+ data.tar.gz: 3622c24de4f843dd0f59f37a3db30c8a9e6feba68644f7dce4168adb7a304f97175a41595c70c789acdd4e2166bfa3eb6547b485ce7e0a476719457530652d54
@@ -9,21 +9,24 @@ module Licensee
9
9
  PREFERRED_EXT = %w[md markdown txt html].freeze
10
10
  PREFERRED_EXT_REGEX = /\.#{Regexp.union(PREFERRED_EXT)}\z/
11
11
 
12
- # Regex to match any extension except .spdx or .header
13
- LICENSE_EXT_REGEX = %r{\.(?!spdx|header)[^./]+\z}i
12
+ # Regex to match any extension and periods in version numbers except .spdx or .header
13
+ LICENSE_EXT_REGEX = %r{\.(?!spdx|header)([^./]|\.\d)+\z}i
14
14
 
15
- # Regex to match any extension except a few unlikely as license
15
+ # Regex to match any extension and periods in version numbers except a few unlikely as license
16
16
  # texts with complex filenames
17
- OTHER_EXT_REGEX = %r{\.(?!xml|go|gemspec)[^./]+\z}i
17
+ OTHER_EXT_REGEX = %r{\.(?!xml|go|gemspec)([^./]|\.\d)+\z}i
18
18
 
19
- # Regex to match any extension
20
- ANY_EXT_REGEX = %r{\.[^./]+\z}i
19
+ # Regex to match any extension and periods in version numbers
20
+ ANY_EXT_REGEX = %r{\.([^./]|\.\d)+\z}i
21
21
 
22
22
  # Regex to match, LICENSE, LICENCE, unlicense, etc.
23
23
  LICENSE_REGEX = /(un)?licen[sc]e/i
24
24
 
25
- # Regex to match COPYING, COPYRIGHT, etc.
26
- COPYING_REGEX = /copy(ing|right)/i
25
+ # Regex to match COPYING
26
+ COPYING_REGEX = /copying/i
27
+
28
+ # Regex to match COPYRIGHT
29
+ COPYRIGHT_REGEX = /copyright/i
27
30
 
28
31
  # Regex to match OFL.
29
32
  OFL_REGEX = /ofl/i
@@ -46,8 +49,12 @@ module Licensee
46
49
  /\A#{OFL_REGEX}#{PREFERRED_EXT_REGEX}/ => 0.50, # OFL.md
47
50
  /\A#{OFL_REGEX}#{OTHER_EXT_REGEX}/ => 0.45, # OFL.textile
48
51
  /\A#{OFL_REGEX}\z/ => 0.40, # OFL
49
- /\A#{PATENTS_REGEX}\z/ => 0.35, # PATENTS
50
- /\A#{PATENTS_REGEX}#{OTHER_EXT_REGEX}\z/ => 0.30, # PATENTS.txt
52
+ /\A#{COPYRIGHT_REGEX}\z/ => 0.35, # COPYRIGHT
53
+ /\A#{COPYRIGHT_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.30, # COPYRIGHT.txt
54
+ /\A#{COPYRIGHT_REGEX}#{OTHER_EXT_REGEX}\z/ => 0.25, # COPYRIGHT.textile
55
+ /\A#{COPYRIGHT_REGEX}[-_][^.]*#{OTHER_EXT_REGEX}?\z/ => 0.20, # COPYRIGHT-MIT
56
+ /\A#{PATENTS_REGEX}\z/ => 0.15, # PATENTS
57
+ /\A#{PATENTS_REGEX}#{OTHER_EXT_REGEX}\z/ => 0.10, # PATENTS.txt
51
58
  // => 0.00 # Catch all
52
59
  }.freeze
53
60
 
@@ -75,7 +82,7 @@ module Licensee
75
82
  end
76
83
 
77
84
  def lgpl?
78
- LicenseFile.lesser_gpl_score(filename) == 1 && license && license.lgpl?
85
+ LicenseFile.lesser_gpl_score(filename) == 1 && license&.lgpl?
79
86
  end
80
87
 
81
88
  def gpl?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Licensee
4
- VERSION = '9.17.1'
4
+ VERSION = '9.18.0'
5
5
  end
@@ -93,7 +93,7 @@
93
93
  },
94
94
  {
95
95
  "filename": "licensee.gemspec",
96
- "content": "# frozen_string_literal: true\n\nrequire File.expand_path('lib/licensee/version', __dir__)\n\nGem::Specification.new do |gem|\n gem.name = 'licensee'\n gem.version = Licensee::VERSION\n\n gem.summary = 'A Ruby Gem to detect open source project licenses'\n gem.description = <<-DESC\n Licensee automates the process of reading LICENSE files and\n compares their contents to known licenses using a fancy maths.\n DESC\n\n gem.authors = ['Ben Balter']\n gem.email = 'ben.balter@github.com'\n gem.homepage = 'https://github.com/benbalter/licensee'\n gem.license = 'MIT'\n gem.metadata['rubygems_mfa_required'] = 'true'\n\n gem.bindir = 'bin'\n gem.executables << 'licensee'\n\n gem.add_dependency('dotenv', '>= 2', '< 4')\n gem.add_dependency('octokit', '>= 4.20', '< 9.0')\n gem.add_dependency('reverse_markdown', '>= 1', '< 3')\n gem.add_dependency('rugged', '>= 0.24', '<2.0')\n gem.add_dependency('thor', '>= 0.19', '< 2.0')\n\n gem.add_development_dependency('gem-release', '~> 2.0')\n gem.add_development_dependency('mustache', '>= 0.9', '< 2.0')\n gem.add_development_dependency('pry', '~> 0.9')\n gem.add_development_dependency('rspec', '~> 3.5')\n gem.add_development_dependency('rubocop', '~> 1.0')\n gem.add_development_dependency('rubocop-performance', '~> 1.5')\n gem.add_development_dependency('rubocop-rspec', '~> 2.0')\n gem.add_development_dependency('simplecov', '~> 0.16')\n gem.add_development_dependency('webmock', '~> 3.1')\n\n gem.required_ruby_version = '>= 3.0'\n\n # ensure the gem is built out of versioned files\n gem.files = Dir[\n '{bin,lib,man,test,vendor,spec}/**/*',\n 'README*', 'LICENSE*'\n ] & `git ls-files -z`.split(\"\\0\")\nend\n",
96
+ "content": "# frozen_string_literal: true\n\nrequire File.expand_path('lib/licensee/version', __dir__)\n\nGem::Specification.new do |gem|\n gem.name = 'licensee'\n gem.version = Licensee::VERSION\n\n gem.summary = 'A Ruby Gem to detect open source project licenses'\n gem.description = <<-DESC\n Licensee automates the process of reading LICENSE files and\n compares their contents to known licenses using a fancy maths.\n DESC\n\n gem.authors = ['Ben Balter']\n gem.email = 'ben.balter@github.com'\n gem.homepage = 'https://github.com/benbalter/licensee'\n gem.license = 'MIT'\n gem.metadata['rubygems_mfa_required'] = 'true'\n\n gem.bindir = 'bin'\n gem.executables << 'licensee'\n\n gem.add_dependency('dotenv', '>= 2', '< 4')\n gem.add_dependency('octokit', '>= 4.20', '< 10.0')\n gem.add_dependency('reverse_markdown', '>= 1', '< 4')\n gem.add_dependency('rugged', '>= 0.24', '<2.0')\n gem.add_dependency('thor', '>= 0.19', '< 2.0')\n\n gem.add_development_dependency('gem-release', '~> 2.0')\n gem.add_development_dependency('mustache', '>= 0.9', '< 2.0')\n gem.add_development_dependency('pry', '~> 0.9')\n gem.add_development_dependency('rspec', '~> 3.5')\n gem.add_development_dependency('rubocop', '~> 1.0')\n gem.add_development_dependency('rubocop-performance', '~> 1.5')\n gem.add_development_dependency('rubocop-rspec', '~> 3.0')\n gem.add_development_dependency('simplecov', '~> 0.16')\n gem.add_development_dependency('webmock', '~> 3.1')\n\n gem.required_ruby_version = '>= 3.0'\n\n # ensure the gem is built out of versioned files\n gem.files = Dir[\n '{bin,lib,man,test,vendor,spec}/**/*',\n 'README*', 'LICENSE*'\n ] & `git ls-files -z`.split(\"\\0\")\nend\n",
97
97
  "content_hash": null,
98
98
  "content_normalized": null,
99
99
  "matcher": {
@@ -261,7 +261,7 @@ RSpec.describe Licensee::ContentHelper do
261
261
  end
262
262
 
263
263
  it 'normalizes http: to https:' do
264
- license = Licensee::License.find('mpl-2.0')
264
+ license = Licensee::License.find('ofl-1.1')
265
265
  expect(license.content).to include('http:')
266
266
  expect(license.content_normalized).not_to include('http:')
267
267
  end
@@ -65,18 +65,18 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
65
65
  'LICENSE.md' => 0.95,
66
66
  'license.txt' => 0.95,
67
67
  'COPYING' => 0.90,
68
- 'copyRIGHT' => 0.90,
69
- 'COPYRIGHT.txt' => 0.85,
68
+ 'copyRIGHT' => 0.35,
69
+ 'COPYRIGHT.txt' => 0.30,
70
70
  'copying.txt' => 0.85,
71
+ 'LICENSE.MPL-2.0' => 0.80,
71
72
  'LICENSE.php' => 0.80,
72
73
  'LICENCE.docs' => 0.80,
73
74
  'license.xml' => 0.80,
74
75
  'copying.image' => 0.75,
75
- 'COPYRIGHT.go' => 0.75,
76
76
  'LICENSE-MIT' => 0.70,
77
77
  'LICENSE_1_0.txt' => 0.70,
78
78
  'COPYING-GPL' => 0.65,
79
- 'COPYRIGHT-BSD' => 0.65,
79
+ 'COPYRIGHT-BSD' => 0.20,
80
80
  'MIT-LICENSE.txt' => 0.60,
81
81
  'mit-license-foo.md' => 0.60,
82
82
  'OFL.md' => 0.50,
@@ -151,14 +151,6 @@ RSpec.describe Licensee::ProjectFiles::LicenseFile do
151
151
  end
152
152
  end
153
153
  end
154
-
155
- context 'copying regex' do
156
- %w[COPYING copyright].each do |copying|
157
- it "matches #{copying}" do
158
- expect(described_class::COPYING_REGEX).to match(copying)
159
- end
160
- end
161
- end
162
154
  end
163
155
 
164
156
  context 'CC false positives' do
data/spec/spec_helper.rb CHANGED
@@ -131,7 +131,7 @@ RSpec::Matchers.define :be_detected_as do |expected|
131
131
  license_name = expected.meta['spdx-id'] || expected.key
132
132
  similarity = expected.similarity(license_file)
133
133
  content = @license_file.content
134
- msg = +"Expected '#{content}' to match the #{license_name} license"
134
+ msg = "Expected '#{content}' to match the #{license_name} license"
135
135
  msg << " (#{format_percent(similarity)} similarity"
136
136
  msg << "using the #{license_file.matcher} matcher)"
137
137
  end
@@ -141,7 +141,7 @@ RSpec::Matchers.define :be_detected_as do |expected|
141
141
  license_name = expected.meta['spdx-id'] || expected.key
142
142
  similarity = expected.similarity(license_file)
143
143
 
144
- msg = +"Expected the content to *not* match the #{license_name} license"
144
+ msg = "Expected the content to *not* match the #{license_name} license"
145
145
  msg << " (#{format_percent(similarity)} similarity)"
146
146
  end
147
147
 
@@ -393,7 +393,7 @@ Exhibit A - Source Code Form License Notice
393
393
 
394
394
  This Source Code Form is subject to the terms of the Mozilla Public
395
395
  License, v. 2.0. If a copy of the MPL was not distributed with this
396
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
396
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
397
397
 
398
398
  If it is not possible or desirable to put the notice in a particular
399
399
  file, then You may include the notice in a location (such as a LICENSE
@@ -28,7 +28,7 @@
28
28
  </item>
29
29
  <item>
30
30
  <bullet>3.</bullet>
31
- <alt match="(The\s+name\s+of.+may\s+not)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+their\s+contributors\s+may)|(\s*Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+its\s+authors\s+and\s+contributors\s+may)|(Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+(specific\s+)?contributors,?\s+may)|(Neither\s+the\s+name.+nor\s+the\s+names\s+of\s+contributors\s+may)|(The\s+names\s+of\s+its\s+contributors\s+may\s+not)|(The\s+names\s+of\s+any\s+contributors\s+may\s+not)|(The\s+names\s+of\s+the\s+contributors\s+may\s+not)|(None\s+of\s+the\s+names\s+of.+and\s+any\s+contributors\s+may)|(Neither\s+my\s+name.+nor\s+the\s+names\s+of\s+contributors\s+to\s+this\s+code\s+may)" name="organizationClause3">
31
+ <alt match="(The\s+name\s+of.+may\s+not)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)|(Neither\s+the\s+names?\s+of.+nor\s+the\s+names\s+of\s+their\s+contributors\s+may)|(\s*Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+its\s+authors\s+and\s+contributors\s+may)|(Neither\s+the\s+name\s+of.+nor\s+the\s+names\s+of\s+(specific\s+)?contributors,?\s+may)|(Neither\s+the\s+name.+nor\s+the\s+names\s+of\s+contributors\s+may)|(The\s+names\s+of\s+its\s+contributors\s+may\s+not)|(The\s+names\s+of\s+any\s+contributors\s+may\s+not)|(The\s+names\s+of\s+the\s+contributors\s+may\s+not)|(None\s+of\s+the\s+names\s+of.+and\s+any\s+contributors\s+may)|(Neither\s+my\s+name.+nor\s+the\s+names\s+of\s+contributors\s+to\s+this\s+code\s+may)|(Neither\s+name\s+of\s+copyright\s+holders\s+nor\s+the\s+names\s+of\s+its\s+contributors\s+may)" name="organizationClause3">
32
32
  Neither the name of the copyright holder nor the names of its contributors may</alt>
33
33
  be used to endorse or promote products derived from this
34
34
  <alt match="software|work" name="software">software</alt> without specific prior written permission.
@@ -459,7 +459,7 @@
459
459
  <optional><p>-------------------------------------------</p></optional>
460
460
  <standardLicenseHeader>
461
461
  <p>This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
462
- was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.</p>
462
+ was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.</p>
463
463
  </standardLicenseHeader>
464
464
  <p>If it is not possible or desirable to put the notice in a particular file, then You may include the
465
465
  notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: licensee
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.17.1
4
+ version: 9.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Balter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-11 00:00:00.000000000 Z
11
+ date: 2024-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '1'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '3'
62
+ version: '4'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '1'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '3'
72
+ version: '4'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: rugged
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -206,14 +206,14 @@ dependencies:
206
206
  requirements:
207
207
  - - "~>"
208
208
  - !ruby/object:Gem::Version
209
- version: '2.0'
209
+ version: '3.0'
210
210
  type: :development
211
211
  prerelease: false
212
212
  version_requirements: !ruby/object:Gem::Requirement
213
213
  requirements:
214
214
  - - "~>"
215
215
  - !ruby/object:Gem::Version
216
- version: '2.0'
216
+ version: '3.0'
217
217
  - !ruby/object:Gem::Dependency
218
218
  name: simplecov
219
219
  requirement: !ruby/object:Gem::Requirement
@@ -519,7 +519,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
519
519
  - !ruby/object:Gem::Version
520
520
  version: '0'
521
521
  requirements: []
522
- rubygems_version: 3.4.19
522
+ rubygems_version: 3.5.11
523
523
  signing_key:
524
524
  specification_version: 4
525
525
  summary: A Ruby Gem to detect open source project licenses