Skip to content

Commit a4c1766

Browse files
committed
Fix chefstyle violations.
Signed-off-by: Pete Higgins <[email protected]>
1 parent d7f520c commit a4c1766

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

bin/license_scout

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# limitations under the License.
1717
#
1818

19-
$:.unshift File.expand_path("../../lib", __FILE__)
19+
$:.unshift File.expand_path("../lib", __dir__)
2020

2121
require "license_scout"
2222

lib/license_scout/cli.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
# limitations under the License.
1616
#
1717

18-
require "zlib" # Temporarily require before rugged to fix https://github.com/prontolabs/pronto/issues/23
18+
require "zlib" unless defined?(Zlib) # Temporarily require before rugged to fix https://github.com/prontolabs/pronto/issues/23
1919

20-
require "mixlib/cli"
20+
require "mixlib/cli" unless defined?(Mixlib::CLI)
2121
require "license_scout/config"
2222
require "license_scout/exporter"
2323
require "license_scout/collector"
@@ -85,7 +85,7 @@ def run(argv = ARGV)
8585

8686
LicenseScout::Config.config_files.each do |config_file|
8787
if config_file =~ /^http/
88-
require "open-uri"
88+
require "open-uri" unless defined?(OpenURI)
8989

9090
LicenseScout::Log.info("[cli] Loading config from #{config_file}")
9191

lib/license_scout/config.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# limitations under the License.
1616
#
1717

18-
require "mixlib/config"
19-
require "tmpdir"
18+
require "mixlib/config" unless defined?(Mixlib::Config)
19+
require "tmpdir" unless defined?(Dir.mktmpdir)
2020

2121
require "license_scout/exceptions"
2222
require "license_scout/log"

lib/license_scout/dependency_manager/base.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
require "license_scout/exceptions"
2121

2222
require "bundler"
23-
require "ffi_yajl"
24-
require "net/http"
25-
require "mixlib/shellout"
26-
require "pathname"
23+
require "ffi_yajl" unless defined?(FFI_Yajl)
24+
require "net/http" unless defined?(Net::HTTP)
25+
require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
26+
require "pathname" unless defined?(Pathname)
2727
require "psych"
28-
require "set"
28+
require "set" unless defined?(Set)
2929
require "toml-rb"
30-
require "yaml"
30+
require "yaml" unless defined?(YAML)
3131

3232
module LicenseScout
3333
# The DependencyManager module (or more accurately, implementations of it) are responsible for recognizing

lib/license_scout/exporter/csv.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
require "csv"
18+
require "csv" unless defined?(CSV)
1919

2020
module LicenseScout
2121
class Exporter

lib/license_scout/reporter.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
require "ffi_yajl"
18+
require "ffi_yajl" unless defined?(FFI_Yajl)
1919
require "terminal-table"
2020

2121
require "license_scout/exceptions"

lib/license_scout/spdx.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# This library was inspired by (and pulls some logic from) librariesio/spdx
1919

20-
require "ffi_yajl"
20+
require "ffi_yajl" unless defined?(FFI_Yajl)
2121
require "fuzzy_match"
2222

2323
module LicenseScout
@@ -45,12 +45,12 @@ def parse(license_string)
4545

4646
# @return [Hash] The SPDX license data in Hash form
4747
def licenses
48-
@@license_data ||= FFI_Yajl::Parser.parse(File.read(File.expand_path("../data/licenses.json", __FILE__)))["licenses"]
48+
@@license_data ||= FFI_Yajl::Parser.parse(File.read(File.expand_path("data/licenses.json", __dir__)))["licenses"]
4949
end
5050

5151
# @return [Hash] The SPDX license data in Hash form
5252
def exceptions
53-
@@license_data ||= FFI_Yajl::Parser.parse(File.read(File.expand_path("../data/exceptions.json", __FILE__)))["exceptions"]
53+
@@license_data ||= FFI_Yajl::Parser.parse(File.read(File.expand_path("data/exceptions.json", __dir__)))["exceptions"]
5454
end
5555

5656
def known_ids

license_scout.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
lib = File.expand_path("../lib", __FILE__)
18+
lib = File.expand_path("lib", __dir__)
1919
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2020
require "license_scout/version"
2121

0 commit comments

Comments
 (0)