license_finder 5.4.1 → 5.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +18 -12
  3. data/Dockerfile +7 -4
  4. data/README.md +15 -14
  5. data/Rakefile +9 -1
  6. data/bin/license_finder +1 -0
  7. data/ci/pipelines/{pipeline.yml.erb → pull-request.yml.erb} +25 -37
  8. data/ci/pipelines/release.yml.erb +199 -0
  9. data/ci/scripts/run-rubocop.sh +1 -1
  10. data/ci/scripts/run-tests.sh +0 -14
  11. data/ci/tasks/run-tests.yml +10 -0
  12. data/dlf +2 -2
  13. data/lib/license_finder.rb +2 -0
  14. data/lib/license_finder/cli.rb +2 -0
  15. data/lib/license_finder/cli/approvals.rb +2 -0
  16. data/lib/license_finder/cli/base.rb +2 -0
  17. data/lib/license_finder/cli/blacklist.rb +2 -0
  18. data/lib/license_finder/cli/dependencies.rb +2 -0
  19. data/lib/license_finder/cli/ignored_dependencies.rb +2 -0
  20. data/lib/license_finder/cli/ignored_groups.rb +2 -0
  21. data/lib/license_finder/cli/licenses.rb +2 -0
  22. data/lib/license_finder/cli/main.rb +3 -0
  23. data/lib/license_finder/cli/makes_decisions.rb +2 -0
  24. data/lib/license_finder/cli/patched_thor.rb +2 -0
  25. data/lib/license_finder/cli/project_name.rb +2 -0
  26. data/lib/license_finder/cli/whitelist.rb +2 -0
  27. data/lib/license_finder/configuration.rb +3 -0
  28. data/lib/license_finder/core.rb +3 -1
  29. data/lib/license_finder/decision_applier.rb +2 -0
  30. data/lib/license_finder/decisions.rb +2 -0
  31. data/lib/license_finder/decisions_factory.rb +2 -0
  32. data/lib/license_finder/diff.rb +5 -3
  33. data/lib/license_finder/license.rb +2 -0
  34. data/lib/license_finder/license/any_matcher.rb +2 -0
  35. data/lib/license_finder/license/definitions.rb +2 -0
  36. data/lib/license_finder/license/header_matcher.rb +2 -0
  37. data/lib/license_finder/license/matcher.rb +2 -0
  38. data/lib/license_finder/license/none_matcher.rb +2 -0
  39. data/lib/license_finder/license/template.rb +2 -0
  40. data/lib/license_finder/license/text.rb +2 -0
  41. data/lib/license_finder/license_aggregator.rb +4 -0
  42. data/lib/license_finder/logger.rb +6 -2
  43. data/lib/license_finder/package.rb +3 -0
  44. data/lib/license_finder/package_delta.rb +3 -1
  45. data/lib/license_finder/package_manager.rb +5 -1
  46. data/lib/license_finder/package_managers/bower.rb +2 -0
  47. data/lib/license_finder/package_managers/bundler.rb +3 -0
  48. data/lib/license_finder/package_managers/cargo.rb +3 -0
  49. data/lib/license_finder/package_managers/carthage.rb +2 -0
  50. data/lib/license_finder/package_managers/cocoa_pods.rb +2 -0
  51. data/lib/license_finder/package_managers/conan.rb +2 -0
  52. data/lib/license_finder/package_managers/dep.rb +2 -0
  53. data/lib/license_finder/package_managers/glide.rb +2 -0
  54. data/lib/license_finder/package_managers/go_15vendorexperiment.rb +4 -0
  55. data/lib/license_finder/package_managers/go_dep.rb +26 -20
  56. data/lib/license_finder/package_managers/go_modules.rb +62 -0
  57. data/lib/license_finder/package_managers/go_workspace.rb +6 -0
  58. data/lib/license_finder/package_managers/govendor.rb +15 -3
  59. data/lib/license_finder/package_managers/gradle.rb +2 -0
  60. data/lib/license_finder/package_managers/gvt.rb +5 -1
  61. data/lib/license_finder/package_managers/maven.rb +2 -0
  62. data/lib/license_finder/package_managers/mix.rb +2 -0
  63. data/lib/license_finder/package_managers/npm.rb +4 -0
  64. data/lib/license_finder/package_managers/nuget.rb +5 -0
  65. data/lib/license_finder/package_managers/pip.rb +4 -1
  66. data/lib/license_finder/package_managers/rebar.rb +2 -0
  67. data/lib/license_finder/package_managers/sbt.rb +2 -0
  68. data/lib/license_finder/package_managers/yarn.rb +6 -2
  69. data/lib/license_finder/package_utils/activation.rb +2 -0
  70. data/lib/license_finder/package_utils/conan_info_parser.rb +3 -0
  71. data/lib/license_finder/package_utils/gradle_dependency_finder.rb +2 -0
  72. data/lib/license_finder/package_utils/license_files.rb +4 -1
  73. data/lib/license_finder/package_utils/licensing.rb +5 -3
  74. data/lib/license_finder/package_utils/maven_dependency_finder.rb +2 -0
  75. data/lib/license_finder/package_utils/possible_license_file.rb +2 -0
  76. data/lib/license_finder/package_utils/sbt_dependency_finder.rb +2 -0
  77. data/lib/license_finder/packages/bower_package.rb +2 -0
  78. data/lib/license_finder/packages/bundler_package.rb +2 -0
  79. data/lib/license_finder/packages/cargo_package.rb +2 -0
  80. data/lib/license_finder/packages/carthage_package.rb +2 -0
  81. data/lib/license_finder/packages/cocoa_pods_package.rb +2 -0
  82. data/lib/license_finder/packages/conan_package.rb +2 -0
  83. data/lib/license_finder/packages/go_package.rb +4 -0
  84. data/lib/license_finder/packages/gradle_package.rb +2 -0
  85. data/lib/license_finder/packages/manual_package.rb +2 -0
  86. data/lib/license_finder/packages/maven_package.rb +2 -0
  87. data/lib/license_finder/packages/merged_package.rb +2 -0
  88. data/lib/license_finder/packages/mix_package.rb +2 -0
  89. data/lib/license_finder/packages/npm_package.rb +5 -0
  90. data/lib/license_finder/packages/nuget_package.rb +2 -0
  91. data/lib/license_finder/packages/pip_package.rb +4 -0
  92. data/lib/license_finder/packages/rebar_package.rb +2 -0
  93. data/lib/license_finder/packages/sbt_package.rb +2 -0
  94. data/lib/license_finder/packages/yarn_package.rb +2 -0
  95. data/lib/license_finder/platform.rb +2 -0
  96. data/lib/license_finder/project_finder.rb +3 -0
  97. data/lib/license_finder/report.rb +2 -0
  98. data/lib/license_finder/scanner.rb +3 -1
  99. data/lib/license_finder/shared_helpers/cmd.rb +2 -0
  100. data/lib/license_finder/shared_helpers/common_path.rb +8 -6
  101. data/lib/license_finder/version.rb +3 -1
  102. data/license_finder.gemspec +5 -2
  103. metadata +21 -5
  104. data/ci/pipelines/release.yml +0 -112
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash -e
2
2
 
3
3
  cd LicenseFinder
4
- gem install rubocop --version 0.51
4
+ gem install rubocop --version 0.59.2
5
5
 
6
6
 
7
7
  echo "Running Rubocop ..."
@@ -5,8 +5,6 @@ set -o pipefail
5
5
  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6
6
  PROJECT_ROOT="$( dirname "$( dirname $DIR )" )"
7
7
 
8
- RUBY_VERSION_UNDER_TEST=$1
9
-
10
8
  pushd "$PROJECT_ROOT"
11
9
 
12
10
  rvm install --default $RUBY_VERSION_UNDER_TEST
@@ -19,18 +17,6 @@ pushd "$PROJECT_ROOT"
19
17
  gem install bundler
20
18
  bundle install
21
19
 
22
- # jruby-9 specific: requires >= rack 2.x
23
- if [ "$RUBY_VERSION_UNDER_TEST" == "jruby-9.0.4.0" ]
24
- then
25
- bundle update rack
26
- apt-get -y install software-properties-common
27
- add-apt-repository -y ppa:webupd8team/java
28
- apt-get update
29
- echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | sudo debconf-set-selections
30
- apt-get -y install oracle-java8-set-default
31
- fi
32
-
33
-
34
20
  bundle exec rake install
35
21
  bundle exec rake spec
36
22
  bundle exec rake features
@@ -0,0 +1,10 @@
1
+ platform: linux
2
+
3
+ inputs:
4
+ - name: LicenseFinder
5
+
6
+ run:
7
+ path: ./LicenseFinder/ci/scripts/run-tests.sh
8
+
9
+ params:
10
+ RUBY_VERSION_UNDER_TEST:
data/dlf CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/bin/bash
2
2
  if `which docker > /dev/null`; then
3
3
  if [ $# -eq 0 ]; then
4
- docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && /bin/bash -l"
4
+ docker run -v $PWD:/scan -it licensefinder/license_finder
5
5
  else
6
- docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && bundle install && `echo $@`"
6
+ docker run -v $PWD:/scan -it licensefinder/license_finder /bin/bash -lc "cd /scan && `echo $@`"
7
7
  fi
8
8
  else
9
9
  echo "You do not have docker installed. Please install it:"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'pathname'
2
4
  require 'yaml'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class Approvals < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'thor'
2
4
 
3
5
  module LicenseFinder
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class Blacklist < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class Dependencies < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class IgnoredDependencies < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class IgnoredGroups < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class Licenses < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'license_finder/report'
2
4
  require 'license_finder/version'
3
5
  require 'license_finder/diff'
@@ -172,6 +174,7 @@ module LicenseFinder
172
174
  aggregate_paths = ProjectFinder.new(project_path, config.strict_matching).find_projects if config.recursive
173
175
  say(aggregate_paths || project_path) if config.strict_matching
174
176
  return aggregate_paths unless aggregate_paths.nil? || aggregate_paths.empty?
177
+
175
178
  [config.project_path] unless config.project_path.nil?
176
179
  end
177
180
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  module MakesDecisions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  module Rootcommand
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class ProjectName < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  module CLI
3
5
  class Whitelist < Base
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'platform'
2
4
 
3
5
  module LicenseFinder
@@ -16,6 +18,7 @@ module LicenseFinder
16
18
 
17
19
  def valid_project_path?
18
20
  return project_path.exist? if get(:project_path)
21
+
19
22
  true
20
23
  end
21
24
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'forwardable'
2
4
 
3
5
  require 'license_finder/logger'
@@ -73,7 +75,7 @@ module LicenseFinder
73
75
  def decision_applier
74
76
  # lazy, do not move to `initialize`
75
77
  # Needs to be lazy loaded to prvent multiple decision appliers being created each time
76
- @applier ||= DecisionApplier.new(decisions: decisions, packages: current_packages)
78
+ @decision_applier ||= DecisionApplier.new(decisions: decisions, packages: current_packages)
77
79
  end
78
80
 
79
81
  def current_packages
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class DecisionApplier
3
5
  def initialize(options)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class Decisions
3
5
  ######
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class DecisionsFactory
3
5
  @decisions = {}
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class Diff
3
5
  class << self
4
- def compare(f1, f2)
5
- p1 = Set.new(build_packages(f1))
6
- p2 = Set.new(build_packages(f2))
6
+ def compare(file1, file2)
7
+ p1 = Set.new(build_packages(file1))
8
+ p2 = Set.new(build_packages(file2))
7
9
 
8
10
  added = p2.difference(p1).to_a
9
11
  removed = p1.difference(p2).to_a
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'license_finder/license/text'
2
4
  require 'license_finder/license/template'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  class AnyMatcher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  module Definitions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  HeaderMatcher = Struct.new(:base_matcher) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  Matcher = Struct.new(:regexp) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  class NoneMatcher
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  class Template
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class License
3
5
  module Text
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class LicenseAggregator
3
5
  def initialize(config, aggregate_paths)
@@ -28,6 +30,7 @@ module LicenseFinder
28
30
 
29
31
  def finders
30
32
  return @finders unless @finders.nil?
33
+
31
34
  @finders = if @aggregate_paths.nil?
32
35
  [LicenseFinder::Core.new(@config)]
33
36
  else
@@ -42,6 +45,7 @@ module LicenseFinder
42
45
 
43
46
  def aggregate_packages
44
47
  return @packages unless @packages.nil?
48
+
45
49
  all_packages = finders.flat_map do |finder|
46
50
  finder.prepare_projects if @config.prepare
47
51
  finder.acknowledged.map { |dep| MergedPackage.new(dep, [finder.project_path]) }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logger'
2
4
 
3
5
  module LicenseFinder
@@ -39,16 +41,18 @@ module LicenseFinder
39
41
  end
40
42
  end
41
43
 
42
- def mode=(v)
43
- @mode = v
44
+ def mode=(verbose)
45
+ @mode = verbose
44
46
 
45
47
  return if quiet?
48
+
46
49
  level = @mode.equal?(MODE_DEBUG) ? ::Logger::DEBUG : ::Logger::INFO
47
50
  system_logger.level = level
48
51
  end
49
52
 
50
53
  def log(msg, method)
51
54
  return if quiet?
55
+
52
56
  system_logger.send(method, msg)
53
57
  end
54
58
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'license_finder/package_utils/licensing'
2
4
  require 'license_finder/package_utils/license_files'
3
5
 
@@ -102,6 +104,7 @@ module LicenseFinder
102
104
  def <=>(other)
103
105
  eq_name = name <=> other.name
104
106
  return eq_name unless eq_name.zero?
107
+
105
108
  version <=> other.version
106
109
  end
107
110
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  class PackageDelta
3
5
  STATUSES = %i[added removed unchanged].freeze
@@ -53,7 +55,7 @@ module LicenseFinder
53
55
  private
54
56
 
55
57
  def pick_package
56
- @current_package ? @current_package : @previous_package
58
+ @current_package || @previous_package
57
59
  end
58
60
  end
59
61
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module LicenseFinder
2
4
  # Super-class for the different package managers
3
5
  # (Bundler, NPM, Pip, etc.)
@@ -66,7 +68,7 @@ module LicenseFinder
66
68
 
67
69
  def active?
68
70
  path = detected_package_path
69
- path && path.exist?
71
+ path&.exist?
70
72
  end
71
73
 
72
74
  def detected_package_path
@@ -90,6 +92,7 @@ module LicenseFinder
90
92
  packages = current_packages
91
93
  rescue StandardError => e
92
94
  raise e unless @prepare_no_fail
95
+
93
96
  packages = []
94
97
  end
95
98
 
@@ -130,6 +133,7 @@ require 'license_finder/package_managers/go_dep'
130
133
  require 'license_finder/package_managers/gvt'
131
134
  require 'license_finder/package_managers/glide'
132
135
  require 'license_finder/package_managers/govendor'
136
+ require 'license_finder/package_managers/go_modules'
133
137
  require 'license_finder/package_managers/bundler'
134
138
  require 'license_finder/package_managers/npm'
135
139
  require 'license_finder/package_managers/yarn'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module LicenseFinder
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
 
3
5
  module LicenseFinder
@@ -47,6 +49,7 @@ module LicenseFinder
47
49
 
48
50
  def gem_details
49
51
  return @gem_details if @gem_details
52
+
50
53
  # clear gem paths before runninng specs_for
51
54
  Gem.clear_paths
52
55
  @gem_details = definition.specs_for(included_groups)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module LicenseFinder
@@ -27,6 +29,7 @@ module LicenseFinder
27
29
 
28
30
  stdout, stderr, status = Dir.chdir(project_path) { Cmd.run(command) }
29
31
  raise "Command '#{command}' failed to execute: #{stderr}" unless status.success?
32
+
30
33
  JSON(stdout)
31
34
  .fetch('packages', [])
32
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module LicenseFinder
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
 
3
5
  module LicenseFinder