license_finder 6.8.0 → 6.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +5 -4
- data/Dockerfile +19 -4
- data/README.md +26 -11
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/ci/pipelines/pull-request.yml.erb +2 -0
- data/ci/pipelines/release.yml.erb +2 -0
- data/ci/tasks/rubocop.yml +2 -0
- data/ci/tasks/update-changelog.yml +2 -0
- data/examples/Gemfile +4 -0
- data/examples/custom_erb_template.rb +24 -0
- data/examples/extract_license_data.rb +63 -0
- data/examples/sample_template.erb +7 -0
- data/lib/license_finder/cli/base.rb +8 -1
- data/lib/license_finder/cli/main.rb +5 -1
- data/lib/license_finder/configuration.rb +12 -0
- data/lib/license_finder/core.rb +5 -2
- data/lib/license_finder/decisions.rb +9 -4
- data/lib/license_finder/license.rb +11 -4
- data/lib/license_finder/license/text.rb +2 -2
- data/lib/license_finder/package.rb +1 -0
- data/lib/license_finder/package_manager.rb +10 -5
- data/lib/license_finder/package_managers/composer.rb +8 -4
- data/lib/license_finder/package_managers/conda.rb +131 -0
- data/lib/license_finder/package_managers/erlangmk.rb +14 -7
- data/lib/license_finder/package_managers/go_dep.rb +15 -8
- data/lib/license_finder/package_managers/go_modules.rb +3 -1
- data/lib/license_finder/package_managers/npm.rb +1 -1
- data/lib/license_finder/package_managers/yarn.rb +1 -1
- data/lib/license_finder/packages/conda_package.rb +74 -0
- data/lib/license_finder/packages/erlangmk_package.rb +13 -6
- data/lib/license_finder/report.rb +1 -0
- data/lib/license_finder/reports/junit_report.rb +19 -0
- data/lib/license_finder/reports/templates/junit_report.erb +41 -0
- data/lib/license_finder/scanner.rb +25 -2
- data/license_finder.gemspec +2 -1
- metadata +35 -7
@@ -38,7 +38,6 @@ module LicenseFinder
|
|
38
38
|
|
39
39
|
def dep_version
|
40
40
|
@dep_version ||= begin
|
41
|
-
version_prefix_re = Regexp.new('^v')
|
42
41
|
dep_version_unformatted.sub(version_prefix_re, '')
|
43
42
|
end
|
44
43
|
end
|
@@ -81,10 +80,6 @@ module LicenseFinder
|
|
81
80
|
dep =~ word_re
|
82
81
|
end
|
83
82
|
|
84
|
-
def word_re
|
85
|
-
@word_re ||= Regexp.new('^\w+$')
|
86
|
-
end
|
87
|
-
|
88
83
|
def dep_repo_valid?
|
89
84
|
set?(dep_repo_unformatted) &&
|
90
85
|
URI.parse(dep_repo)
|
@@ -96,12 +91,24 @@ module LicenseFinder
|
|
96
91
|
if dep_version =~ version_re
|
97
92
|
Gem::Version.correct?(dep_version)
|
98
93
|
else
|
99
|
-
dep_version =~
|
94
|
+
dep_version =~ word_dot_re
|
100
95
|
end
|
101
96
|
end
|
102
97
|
|
103
98
|
def version_re
|
104
99
|
@version_re ||= Regexp.new('\d+\.\d+\.\d+')
|
105
100
|
end
|
101
|
+
|
102
|
+
def version_prefix_re
|
103
|
+
@version_prefix_re ||= Regexp.new('^v')
|
104
|
+
end
|
105
|
+
|
106
|
+
def word_re
|
107
|
+
@word_re ||= Regexp.new('^\w+$')
|
108
|
+
end
|
109
|
+
|
110
|
+
def word_dot_re
|
111
|
+
@word_dot_re ||= Regexp.new('^[.\w]+$')
|
112
|
+
end
|
106
113
|
end
|
107
114
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'license_finder/reports/erb_report'
|
2
|
+
|
3
|
+
module LicenseFinder
|
4
|
+
class JunitReport < ErbReport
|
5
|
+
ROOT_PATH = Pathname.new(__FILE__).dirname
|
6
|
+
TEMPLATE_PATH = ROOT_PATH.join('templates')
|
7
|
+
|
8
|
+
def to_s(filename = TEMPLATE_PATH.join("#{template_name}.erb"))
|
9
|
+
template = ERB.new(filename.read, nil, '-')
|
10
|
+
template.result(binding)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def template_name
|
16
|
+
'junit_report'
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<testsuites failures="<%= unapproved_dependencies.size %>" name="<%= project_name %>" tests="<%= dependencies.size %>">
|
3
|
+
<% sorted_dependencies.each_with_index do |dependency, i| -%>
|
4
|
+
<testsuite failures="<%= dependency.approved? ? "0" : "1" -%>" id="<%= i %>" name="<%= dependency.name %>" package="Gemfile.lock" skipped="0" tests="1" timestamp="<%= Time.now.strftime("%Y-%m-%dT%H:%M:%S:%6N") %>">
|
5
|
+
<testcase classname="<%= license_names(dependency) %>" name="<%= dependency.name %>"<%= dependency.approved? ? " /" : "" %>>
|
6
|
+
<%- unless dependency.approved? -%>
|
7
|
+
<failure message="Unapproved license in '<%= dependency.name %>' <%= dependency.version %>">
|
8
|
+
Name: <%= dependency.name %>
|
9
|
+
Version: <%= dependency.version %>
|
10
|
+
Licence:
|
11
|
+
<%- if dependency.licenses.any? -%>
|
12
|
+
<%- dependency.licenses.each do |license| -%>- <%=license.name %>: <%=license.url %><% end %>
|
13
|
+
<%- end -%>
|
14
|
+
URL: <%= dependency.package_url %>
|
15
|
+
Homepage: <%= dependency.homepage %>
|
16
|
+
Summary: <%= REXML::Text.new(dependency.summary, false, nil, false) %>
|
17
|
+
Description: <%= REXML::Text.new(dependency.description, false, nil, false) %>
|
18
|
+
<% if dependency.parents.any? %>
|
19
|
+
Dependencies:
|
20
|
+
<% dependency.parents.to_a.each do |dep| -%>
|
21
|
+
- <%= dep %>
|
22
|
+
<% end -%>
|
23
|
+
<% end -%>
|
24
|
+
<%- if dependency.children.any? -%>
|
25
|
+
Requirements:
|
26
|
+
<%- dependency.children.each do |req| -%>
|
27
|
+
- <%= req %>
|
28
|
+
<% end -%>
|
29
|
+
<% end -%>
|
30
|
+
</failure>
|
31
|
+
<system-out>
|
32
|
+
stdout
|
33
|
+
</system-out>
|
34
|
+
<system-err>
|
35
|
+
stderr
|
36
|
+
</system-err>
|
37
|
+
</testcase>
|
38
|
+
<%- end -%>
|
39
|
+
</testsuite>
|
40
|
+
<% end -%>
|
41
|
+
</testsuites>
|
@@ -4,7 +4,8 @@ module LicenseFinder
|
|
4
4
|
class Scanner
|
5
5
|
PACKAGE_MANAGERS = [
|
6
6
|
GoModules, GoDep, GoWorkspace, Go15VendorExperiment, Glide, Gvt, Govendor, Trash, Dep, Bundler, NPM, Pip,
|
7
|
-
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv
|
7
|
+
Yarn, Bower, Maven, Gradle, CocoaPods, Rebar, Erlangmk, Nuget, Carthage, Mix, Conan, Sbt, Cargo, Dotnet, Composer, Pipenv,
|
8
|
+
Conda
|
8
9
|
].freeze
|
9
10
|
|
10
11
|
class << self
|
@@ -12,6 +13,10 @@ module LicenseFinder
|
|
12
13
|
paths.reject { |path| subproject?(Pathname(path)) }
|
13
14
|
end
|
14
15
|
|
16
|
+
def supported_package_manager_ids
|
17
|
+
PACKAGE_MANAGERS.map(&:id)
|
18
|
+
end
|
19
|
+
|
15
20
|
private
|
16
21
|
|
17
22
|
def subproject?(path)
|
@@ -28,6 +33,7 @@ module LicenseFinder
|
|
28
33
|
@config = config
|
29
34
|
@project_path = @config[:project_path]
|
30
35
|
@logger = @config[:logger]
|
36
|
+
@enabled_package_manager_ids = @config[:enabled_package_manager_ids]
|
31
37
|
end
|
32
38
|
|
33
39
|
def active_packages
|
@@ -40,7 +46,7 @@ module LicenseFinder
|
|
40
46
|
return @package_managers if @package_managers
|
41
47
|
|
42
48
|
active_pm_classes = []
|
43
|
-
|
49
|
+
enabled_package_managers.each do |pm_class|
|
44
50
|
active = pm_class.new(@config).active?
|
45
51
|
|
46
52
|
if active
|
@@ -56,5 +62,22 @@ module LicenseFinder
|
|
56
62
|
active_pm_classes -= active_pm_classes.map(&:takes_priority_over)
|
57
63
|
@package_managers = active_pm_classes.map { |pm_class| pm_class.new(@config) }
|
58
64
|
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def enabled_package_managers
|
69
|
+
enabled_pm_ids = @enabled_package_manager_ids
|
70
|
+
|
71
|
+
return PACKAGE_MANAGERS unless enabled_pm_ids
|
72
|
+
|
73
|
+
enabled_pm_classes = PACKAGE_MANAGERS.select { |pm_class| enabled_pm_ids.include?(pm_class.id) }
|
74
|
+
|
75
|
+
if enabled_pm_classes.length != enabled_pm_ids.length
|
76
|
+
unsupported_pm_ids = enabled_pm_ids - self.class.supported_package_manager_ids
|
77
|
+
raise "Unsupported package manager: #{unsupported_pm_ids.join(', ')}"
|
78
|
+
end
|
79
|
+
|
80
|
+
enabled_pm_classes
|
81
|
+
end
|
59
82
|
end
|
60
83
|
end
|
data/license_finder.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
s.add_dependency 'bundler'
|
47
47
|
s.add_dependency 'rubyzip', '>=1', '<3'
|
48
48
|
s.add_dependency 'thor', '~> 1.0.1'
|
49
|
-
s.add_dependency 'tomlrb', '
|
49
|
+
s.add_dependency 'tomlrb', '>= 1.3', '< 2.1'
|
50
50
|
s.add_dependency 'with_env', '1.1.0'
|
51
51
|
s.add_dependency 'xml-simple', '~> 1.1.5'
|
52
52
|
|
@@ -63,6 +63,7 @@ Gem::Specification.new do |s|
|
|
63
63
|
s.add_development_dependency 'rubocop-performance', '~> 1.5.0'
|
64
64
|
s.add_development_dependency 'webmock', '~> 3.5'
|
65
65
|
|
66
|
+
s.add_development_dependency 'nokogiri', '~>1.10'
|
66
67
|
s.add_development_dependency 'rack', '~> 2.2.2'
|
67
68
|
s.add_development_dependency 'rack-test', '~> 1.1.0', '> 0.7'
|
68
69
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: license_finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Collins
|
@@ -27,7 +27,7 @@ authors:
|
|
27
27
|
autorequire:
|
28
28
|
bindir: bin
|
29
29
|
cert_chain: []
|
30
|
-
date:
|
30
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
31
31
|
dependencies:
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: bundler
|
@@ -81,16 +81,22 @@ dependencies:
|
|
81
81
|
name: tomlrb
|
82
82
|
requirement: !ruby/object:Gem::Requirement
|
83
83
|
requirements:
|
84
|
-
- - "
|
84
|
+
- - ">="
|
85
85
|
- !ruby/object:Gem::Version
|
86
|
-
version: 1.3
|
86
|
+
version: '1.3'
|
87
|
+
- - "<"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '2.1'
|
87
90
|
type: :runtime
|
88
91
|
prerelease: false
|
89
92
|
version_requirements: !ruby/object:Gem::Requirement
|
90
93
|
requirements:
|
91
|
-
- - "
|
94
|
+
- - ">="
|
92
95
|
- !ruby/object:Gem::Version
|
93
|
-
version: 1.3
|
96
|
+
version: '1.3'
|
97
|
+
- - "<"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '2.1'
|
94
100
|
- !ruby/object:Gem::Dependency
|
95
101
|
name: with_env
|
96
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -273,6 +279,20 @@ dependencies:
|
|
273
279
|
- - "~>"
|
274
280
|
- !ruby/object:Gem::Version
|
275
281
|
version: '3.5'
|
282
|
+
- !ruby/object:Gem::Dependency
|
283
|
+
name: nokogiri
|
284
|
+
requirement: !ruby/object:Gem::Requirement
|
285
|
+
requirements:
|
286
|
+
- - "~>"
|
287
|
+
- !ruby/object:Gem::Version
|
288
|
+
version: '1.10'
|
289
|
+
type: :development
|
290
|
+
prerelease: false
|
291
|
+
version_requirements: !ruby/object:Gem::Requirement
|
292
|
+
requirements:
|
293
|
+
- - "~>"
|
294
|
+
- !ruby/object:Gem::Version
|
295
|
+
version: '1.10'
|
276
296
|
- !ruby/object:Gem::Dependency
|
277
297
|
name: rack
|
278
298
|
requirement: !ruby/object:Gem::Requirement
|
@@ -351,6 +371,10 @@ files:
|
|
351
371
|
- ci/tasks/run-tests.yml
|
352
372
|
- ci/tasks/update-changelog.yml
|
353
373
|
- dlf
|
374
|
+
- examples/Gemfile
|
375
|
+
- examples/custom_erb_template.rb
|
376
|
+
- examples/extract_license_data.rb
|
377
|
+
- examples/sample_template.erb
|
354
378
|
- lib/license_finder.rb
|
355
379
|
- lib/license_finder/cli.rb
|
356
380
|
- lib/license_finder/cli/approvals.rb
|
@@ -413,6 +437,7 @@ files:
|
|
413
437
|
- lib/license_finder/package_managers/cocoa_pods.rb
|
414
438
|
- lib/license_finder/package_managers/composer.rb
|
415
439
|
- lib/license_finder/package_managers/conan.rb
|
440
|
+
- lib/license_finder/package_managers/conda.rb
|
416
441
|
- lib/license_finder/package_managers/dep.rb
|
417
442
|
- lib/license_finder/package_managers/dotnet.rb
|
418
443
|
- lib/license_finder/package_managers/erlangmk.rb
|
@@ -451,6 +476,7 @@ files:
|
|
451
476
|
- lib/license_finder/packages/cocoa_pods_package.rb
|
452
477
|
- lib/license_finder/packages/composer_package.rb
|
453
478
|
- lib/license_finder/packages/conan_package.rb
|
479
|
+
- lib/license_finder/packages/conda_package.rb
|
454
480
|
- lib/license_finder/packages/erlangmk_package.rb
|
455
481
|
- lib/license_finder/packages/go_package.rb
|
456
482
|
- lib/license_finder/packages/gradle_package.rb
|
@@ -472,10 +498,12 @@ files:
|
|
472
498
|
- lib/license_finder/reports/erb_report.rb
|
473
499
|
- lib/license_finder/reports/html_report.rb
|
474
500
|
- lib/license_finder/reports/json_report.rb
|
501
|
+
- lib/license_finder/reports/junit_report.rb
|
475
502
|
- lib/license_finder/reports/markdown_report.rb
|
476
503
|
- lib/license_finder/reports/merged_report.rb
|
477
504
|
- lib/license_finder/reports/templates/bootstrap.css
|
478
505
|
- lib/license_finder/reports/templates/html_report.erb
|
506
|
+
- lib/license_finder/reports/templates/junit_report.erb
|
479
507
|
- lib/license_finder/reports/templates/markdown_report.erb
|
480
508
|
- lib/license_finder/reports/templates/xml_report.erb
|
481
509
|
- lib/license_finder/reports/text_report.rb
|
@@ -505,7 +533,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
505
533
|
- !ruby/object:Gem::Version
|
506
534
|
version: '0'
|
507
535
|
requirements: []
|
508
|
-
rubygems_version: 3.
|
536
|
+
rubygems_version: 3.2.4
|
509
537
|
signing_key:
|
510
538
|
specification_version: 4
|
511
539
|
summary: Audit the OSS licenses of your application's dependencies.
|