bibliothecary 8.7.4 → 8.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +21 -4
  3. data/.rubocop.yml +32 -941
  4. data/Gemfile +1 -1
  5. data/Rakefile +10 -0
  6. data/bibliothecary.gemspec +2 -2
  7. data/lib/bibliothecary/analyser.rb +6 -6
  8. data/lib/bibliothecary/cli.rb +8 -8
  9. data/lib/bibliothecary/configuration.rb +8 -8
  10. data/lib/bibliothecary/file_info.rb +2 -2
  11. data/lib/bibliothecary/multi_parsers/bundler_like_manifest.rb +1 -1
  12. data/lib/bibliothecary/multi_parsers/cyclonedx.rb +16 -17
  13. data/lib/bibliothecary/multi_parsers/dependencies_csv.rb +16 -16
  14. data/lib/bibliothecary/multi_parsers/json_runtime.rb +3 -3
  15. data/lib/bibliothecary/multi_parsers/spdx.rb +14 -14
  16. data/lib/bibliothecary/parsers/bower.rb +7 -7
  17. data/lib/bibliothecary/parsers/cargo.rb +15 -15
  18. data/lib/bibliothecary/parsers/carthage.rb +16 -16
  19. data/lib/bibliothecary/parsers/clojars.rb +7 -7
  20. data/lib/bibliothecary/parsers/cocoapods.rb +20 -20
  21. data/lib/bibliothecary/parsers/conda.rb +9 -9
  22. data/lib/bibliothecary/parsers/cpan.rb +12 -12
  23. data/lib/bibliothecary/parsers/cran.rb +12 -12
  24. data/lib/bibliothecary/parsers/dub.rb +8 -8
  25. data/lib/bibliothecary/parsers/elm.rb +8 -8
  26. data/lib/bibliothecary/parsers/go.rb +131 -66
  27. data/lib/bibliothecary/parsers/hackage.rb +13 -13
  28. data/lib/bibliothecary/parsers/haxelib.rb +4 -4
  29. data/lib/bibliothecary/parsers/hex.rb +11 -11
  30. data/lib/bibliothecary/parsers/julia.rb +4 -4
  31. data/lib/bibliothecary/parsers/maven.rb +88 -89
  32. data/lib/bibliothecary/parsers/meteor.rb +4 -4
  33. data/lib/bibliothecary/parsers/npm.rb +31 -31
  34. data/lib/bibliothecary/parsers/nuget.rb +44 -44
  35. data/lib/bibliothecary/parsers/packagist.rb +14 -14
  36. data/lib/bibliothecary/parsers/pub.rb +13 -13
  37. data/lib/bibliothecary/parsers/pypi.rb +71 -71
  38. data/lib/bibliothecary/parsers/rubygems.rb +15 -15
  39. data/lib/bibliothecary/parsers/shard.rb +13 -13
  40. data/lib/bibliothecary/parsers/swift_pm.rb +6 -6
  41. data/lib/bibliothecary/purl_util.rb +1 -1
  42. data/lib/bibliothecary/runner.rb +4 -4
  43. data/lib/bibliothecary/version.rb +1 -1
  44. data/lib/bibliothecary.rb +3 -3
  45. data/lib/sdl_parser.rb +5 -5
  46. metadata +2 -2
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Temporarily pegging to HEAD until 0.2.1 is released: https://github.com/piotrmurach/strings-ansi/pull/2
4
4
  gem "strings-ansi", ref: "35d0c9430cf0a8022dc12bdab005bce296cb9f00", git: "git@github.com:piotrmurach/strings-ansi.git"
data/Rakefile CHANGED
@@ -4,3 +4,13 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task default: :spec
7
+
8
+ desc "Run the linter"
9
+ task :lint do
10
+ sh "bundle exec rubocop -P"
11
+ end
12
+
13
+ desc "Run the linter with autofix"
14
+ task :fix do
15
+ sh "bundle exec rubocop -A"
16
+ end
@@ -1,7 +1,7 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'bibliothecary/version'
4
+ require "bibliothecary/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "bibliothecary"
@@ -1,6 +1,6 @@
1
- require_relative './analyser/matchers.rb'
2
- require_relative './analyser/determinations.rb'
3
- require_relative './analyser/analysis.rb'
1
+ require_relative "./analyser/matchers.rb"
2
+ require_relative "./analyser/determinations.rb"
3
+ require_relative "./analyser/analysis.rb"
4
4
 
5
5
  module Bibliothecary
6
6
  module Analyser
@@ -22,7 +22,7 @@ module Bibliothecary
22
22
  path: relative_path,
23
23
  dependencies: dependencies,
24
24
  kind: kind,
25
- success: true
25
+ success: true,
26
26
  }
27
27
  end
28
28
 
@@ -53,7 +53,7 @@ module Bibliothecary
53
53
  end
54
54
 
55
55
  def platform_name
56
- self.name.to_s.split('::').last.downcase
56
+ self.name.to_s.split("::").last.downcase
57
57
  end
58
58
 
59
59
  def map_dependencies(hash, key, type)
@@ -61,7 +61,7 @@ module Bibliothecary
61
61
  {
62
62
  name: name,
63
63
  requirement: requirement,
64
- type: type
64
+ type: type,
65
65
  }
66
66
  end
67
67
  end
@@ -1,22 +1,22 @@
1
- require 'bibliothecary/version'
2
- require 'bibliothecary'
3
- require 'commander'
1
+ require "bibliothecary/version"
2
+ require "bibliothecary"
3
+ require "commander"
4
4
 
5
5
  module Bibliothecary
6
6
  class CLI
7
7
  include Commander::Methods
8
8
 
9
9
  def run
10
- program :name, 'Bibliothecary'
10
+ program :name, "Bibliothecary"
11
11
  program :version, Bibliothecary::VERSION
12
- program :description, 'Parse dependency information from a file or folder of code'
12
+ program :description, "Parse dependency information from a file or folder of code"
13
13
 
14
14
  command(:list) do |c|
15
- c.syntax = 'bibliothecary list'
16
- c.description = 'List dependencies'
15
+ c.syntax = "bibliothecary list"
16
+ c.description = "List dependencies"
17
17
  c.option("--path FILENAME", String, "Path to file/folder to analyse")
18
18
  c.action do |_args, options|
19
- options.default path: './'
19
+ options.default path: "./"
20
20
  output = Bibliothecary.analyse(options.path)
21
21
  output.each do |file_contents|
22
22
  puts "#{file_contents[:path]} (#{file_contents[:platform]})"
@@ -11,15 +11,15 @@ module Bibliothecary
11
11
  attr_accessor :cabal_parser_host
12
12
 
13
13
  def initialize
14
- @ignored_dirs = ['.git', 'node_modules', 'bower_components', 'vendor', 'dist']
14
+ @ignored_dirs = [".git", "node_modules", "bower_components", "vendor", "dist"]
15
15
  @ignored_files = []
16
- @carthage_parser_host = 'https://carthage.libraries.io'
17
- @clojars_parser_host = 'https://clojars.libraries.io'
18
- @mix_parser_host = 'https://mix.libraries.io'
19
- @yarn_parser_host = 'https://yarn-parser.libraries.io'
20
- @conda_parser_host = 'https://conda-parser.libraries.io'
21
- @swift_parser_host = 'http://swift.libraries.io'
22
- @cabal_parser_host = 'http://cabal.libraries.io'
16
+ @carthage_parser_host = "https://carthage.libraries.io"
17
+ @clojars_parser_host = "https://clojars.libraries.io"
18
+ @mix_parser_host = "https://mix.libraries.io"
19
+ @yarn_parser_host = "https://yarn-parser.libraries.io"
20
+ @conda_parser_host = "https://conda-parser.libraries.io"
21
+ @swift_parser_host = "http://swift.libraries.io"
22
+ @cabal_parser_host = "http://cabal.libraries.io"
23
23
  end
24
24
  end
25
25
  end
@@ -1,4 +1,4 @@
1
- require 'pathname'
1
+ require "pathname"
2
2
 
3
3
  module Bibliothecary
4
4
  # A representation of a file on the filesystem, with location information
@@ -17,7 +17,7 @@ module Bibliothecary
17
17
  # file that's actually on the filesystem
18
18
  nil
19
19
  else
20
- contents = Bibliothecary.utf8_string(File.open(@full_path).read)
20
+ Bibliothecary.utf8_string(File.open(@full_path).read)
21
21
  end
22
22
  end
23
23
  end
@@ -13,7 +13,7 @@ module Bibliothecary
13
13
  .sort_by(&:last)
14
14
  .map { |op, version| "#{op} #{version}" }
15
15
  .join(", "),
16
- type: dep.type
16
+ type: dep.type,
17
17
  })
18
18
  end.uniq
19
19
  end
@@ -1,11 +1,11 @@
1
- require 'json'
2
- require 'ox'
1
+ require "json"
2
+ require "ox"
3
3
 
4
4
  # packageurl-ruby uses pattern-matching (https://docs.ruby-lang.org/en/2.7.0/NEWS.html#label-Pattern+matching)
5
5
  # which warns a whole bunch in Ruby 2.7 as being an experimental feature, but has
6
6
  # been accepted in Ruby 3.0 (https://rubyreferences.github.io/rubychanges/3.0.html#pattern-matching).
7
7
  Warning[:experimental] = false
8
- require 'package_url'
8
+ require "package_url"
9
9
  Warning[:experimental] = true
10
10
 
11
11
  module Bibliothecary
@@ -36,7 +36,7 @@ module Bibliothecary
36
36
  @manifests[mapping] << {
37
37
  name: self.class.full_name_for_purl(purl),
38
38
  requirement: purl.version,
39
- type: 'lockfile'
39
+ type: "lockfile",
40
40
  }
41
41
  end
42
42
 
@@ -67,30 +67,29 @@ module Bibliothecary
67
67
 
68
68
  case purl.type
69
69
  when "maven"
70
- parts.join(':')
70
+ parts.join(":")
71
71
  else
72
- parts.join('/')
72
+ parts.join("/")
73
73
  end
74
74
  end
75
75
  end
76
76
 
77
77
  def self.mapping
78
78
  {
79
- match_filename('cyclonedx.json') => {
80
- kind: 'lockfile',
79
+ match_filename("cyclonedx.json") => {
80
+ kind: "lockfile",
81
81
  parser: :parse_cyclonedx_json,
82
- ungroupable: true
82
+ ungroupable: true,
83
83
  },
84
- match_filename('cyclonedx.xml') => {
85
- kind: 'lockfile',
84
+ match_filename("cyclonedx.xml") => {
85
+ kind: "lockfile",
86
86
  parser: :parse_cyclonedx_xml,
87
- ungroupable: true
88
- }
87
+ ungroupable: true,
88
+ },
89
89
  }
90
90
  end
91
91
 
92
92
  def parse_cyclonedx_json(file_contents, options: {})
93
- manifest = nil
94
93
 
95
94
  manifest = try_cache(options, options[:filename]) do
96
95
  JSON.parse(file_contents)
@@ -119,14 +118,14 @@ module Bibliothecary
119
118
  root = root.bom
120
119
  end
121
120
 
122
- raise NoComponents unless root.locate('components').first
121
+ raise NoComponents unless root.locate("components").first
123
122
 
124
- entries = ManifestEntries.new(parse_queue: root.locate('components/*'))
123
+ entries = ManifestEntries.new(parse_queue: root.locate("components/*"))
125
124
 
126
125
  entries.parse! do |component, parse_queue|
127
126
  # #locate returns an empty array if nothing is found, so we can
128
127
  # always safely concatenate it to the parse queue.
129
- parse_queue.concat(component.locate('components/*'))
128
+ parse_queue.concat(component.locate("components/*"))
130
129
 
131
130
  component.locate("purl").first&.text
132
131
  end
@@ -1,4 +1,4 @@
1
- require 'csv'
1
+ require "csv"
2
2
 
3
3
  module Bibliothecary
4
4
  module MultiParsers
@@ -8,11 +8,11 @@ module Bibliothecary
8
8
 
9
9
  def self.mapping
10
10
  {
11
- match_filename('dependencies.csv') => {
12
- kind: 'lockfile',
11
+ match_filename("dependencies.csv") => {
12
+ kind: "lockfile",
13
13
  ungroupable: true,
14
- parser: :parse_dependencies_csv
15
- }
14
+ parser: :parse_dependencies_csv,
15
+ },
16
16
  }
17
17
  end
18
18
 
@@ -29,20 +29,20 @@ module Bibliothecary
29
29
  HEADERS = {
30
30
  "platform" => {
31
31
  match: [
32
- /^platform$/i
33
- ]
32
+ /^platform$/i,
33
+ ],
34
34
  },
35
35
  "name" => {
36
36
  match: [
37
- /^name$/i
38
- ]
37
+ /^name$/i,
38
+ ],
39
39
  },
40
40
  # Lockfiles have exact versions.
41
41
  "lockfile_requirement" => {
42
42
  match: [
43
43
  /^(lockfile |)requirement$/i,
44
- /^version$/i
45
- ]
44
+ /^version$/i,
45
+ ],
46
46
  },
47
47
  # Manifests have versions that can have operators.
48
48
  # However, since Bibliothecary only currently supports analyzing a
@@ -52,16 +52,16 @@ module Bibliothecary
52
52
  "requirement" => {
53
53
  match: [
54
54
  /^(lockfile |)requirement$/i,
55
- /^version$/i
56
- ]
55
+ /^version$/i,
56
+ ],
57
57
  },
58
58
  "type" => {
59
59
  default: "runtime",
60
60
  match: [
61
61
  /^(lockfile |)type$/i,
62
- /^(manifest |)type$/i
63
- ]
64
- }
62
+ /^(manifest |)type$/i,
63
+ ],
64
+ },
65
65
  }
66
66
 
67
67
  attr_reader :result
@@ -2,12 +2,12 @@ module Bibliothecary
2
2
  module MultiParsers
3
3
  # Provide JSON Runtime Manifest parsing
4
4
  module JSONRuntime
5
- def parse_json_runtime_manifest(file_contents, options: {})
6
- JSON.parse(file_contents).fetch('dependencies',[]).map do |name, requirement|
5
+ def parse_json_runtime_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
6
+ JSON.parse(file_contents).fetch("dependencies",[]).map do |name, requirement|
7
7
  {
8
8
  name: name,
9
9
  requirement: requirement,
10
- type: 'runtime'
10
+ type: "runtime",
11
11
  }
12
12
  end
13
13
  end
@@ -2,7 +2,7 @@
2
2
  # which warns a whole bunch in Ruby 2.7 as being an experimental feature, but has
3
3
  # been accepted in Ruby 3.0 (https://rubyreferences.github.io/rubychanges/3.0.html#pattern-matching).
4
4
  Warning[:experimental] = false
5
- require 'package_url'
5
+ require "package_url"
6
6
  Warning[:experimental] = true
7
7
 
8
8
  module Bibliothecary
@@ -12,27 +12,27 @@ module Bibliothecary
12
12
  include Bibliothecary::Analyser::TryCache
13
13
 
14
14
  # e.g. 'SomeText:' (allowing for leading whitespace)
15
- WELLFORMED_LINE_REGEX = /^\s*[a-zA-Z]+:/
15
+ WELLFORMED_LINE_REGEXP = /^\s*[a-zA-Z]+:/
16
16
 
17
17
  # e.g. 'PackageName: (allowing for excessive whitespace)
18
- PACKAGE_NAME_REGEX = /^\s*PackageName:\s*(.*)/
18
+ PACKAGE_NAME_REGEXP = /^\s*PackageName:\s*(.*)/
19
19
 
20
20
  # e.g. 'PackageVersion:' (allowing for excessive whitespace)
21
- PACKAGE_VERSION_REGEX =/^\s*PackageVersion:\s*(.*)/
21
+ PACKAGE_VERSION_REGEXP =/^\s*PackageVersion:\s*(.*)/
22
22
 
23
23
  # e.g. "ExternalRef: PACKAGE-MANAGER purl (allowing for excessive whitespace)
24
- PURL_REGEX = /^\s*ExternalRef:\s*PACKAGE[-|_]MANAGER\s*purl\s*(.*)/
24
+ PURL_REGEXP = /^\s*ExternalRef:\s*PACKAGE[-|_]MANAGER\s*purl\s*(.*)/
25
25
 
26
26
  NoEntries = Class.new(StandardError)
27
27
  MalformedFile = Class.new(StandardError)
28
28
 
29
29
  def self.mapping
30
30
  {
31
- match_extension('.spdx') => {
32
- kind: 'lockfile',
31
+ match_extension(".spdx") => {
32
+ kind: "lockfile",
33
33
  parser: :parse_spdx_tag_value,
34
- ungroupable: true
35
- }
34
+ ungroupable: true,
35
+ },
36
36
  }
37
37
  end
38
38
 
@@ -64,13 +64,13 @@ module Bibliothecary
64
64
 
65
65
  next if skip_line?(stripped_line)
66
66
 
67
- raise MalformedFile unless stripped_line.match(WELLFORMED_LINE_REGEX)
67
+ raise MalformedFile unless stripped_line.match(WELLFORMED_LINE_REGEXP)
68
68
 
69
- if (match = stripped_line.match(PACKAGE_NAME_REGEX))
69
+ if (match = stripped_line.match(PACKAGE_NAME_REGEXP))
70
70
  package_name = match[1]
71
- elsif (match = stripped_line.match(PACKAGE_VERSION_REGEX))
71
+ elsif (match = stripped_line.match(PACKAGE_VERSION_REGEXP))
72
72
  package_version = match[1]
73
- elsif (match = stripped_line.match(PURL_REGEX))
73
+ elsif (match = stripped_line.match(PURL_REGEXP))
74
74
  platform ||= get_platform(match[1])
75
75
  end
76
76
 
@@ -79,7 +79,7 @@ module Bibliothecary
79
79
  entries[platform.to_sym] << {
80
80
  name: package_name,
81
81
  requirement: package_version,
82
- type: 'lockfile'
82
+ type: "lockfile",
83
83
  }
84
84
 
85
85
  package_name = package_version = platform = nil
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  module Bibliothecary
4
4
  module Parsers
@@ -8,18 +8,18 @@ module Bibliothecary
8
8
  def self.mapping
9
9
  {
10
10
  match_filename("bower.json") => {
11
- kind: 'manifest',
12
- parser: :parse_manifest
13
- }
11
+ kind: "manifest",
12
+ parser: :parse_manifest,
13
+ },
14
14
  }
15
15
  end
16
16
 
17
17
  add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV)
18
18
 
19
- def self.parse_manifest(file_contents, options: {})
19
+ def self.parse_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
20
20
  json = JSON.parse(file_contents)
21
- map_dependencies(json, 'dependencies', 'runtime') +
22
- map_dependencies(json, 'devDependencies', 'development')
21
+ map_dependencies(json, "dependencies", "runtime") +
22
+ map_dependencies(json, "devDependencies", "development")
23
23
  end
24
24
  end
25
25
  end
@@ -6,13 +6,13 @@ module Bibliothecary
6
6
  def self.mapping
7
7
  {
8
8
  match_filename("Cargo.toml") => {
9
- kind: 'manifest',
10
- parser: :parse_manifest
9
+ kind: "manifest",
10
+ parser: :parse_manifest,
11
11
  },
12
12
  match_filename("Cargo.lock") => {
13
- kind: 'lockfile',
14
- parser: :parse_lockfile
15
- }
13
+ kind: "lockfile",
14
+ parser: :parse_lockfile,
15
+ },
16
16
  }
17
17
  end
18
18
 
@@ -20,20 +20,20 @@ module Bibliothecary
20
20
  add_multi_parser(Bibliothecary::MultiParsers::Spdx)
21
21
  add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV)
22
22
 
23
- def self.parse_manifest(file_contents, options: {})
23
+ def self.parse_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
24
24
  manifest = Tomlrb.parse(file_contents)
25
25
 
26
26
  parsed_dependencies = []
27
27
 
28
- manifest.fetch_values('dependencies', 'dev-dependencies').each_with_index do |deps, index|
28
+ manifest.fetch_values("dependencies", "dev-dependencies").each_with_index do |deps, index|
29
29
  parsed_dependencies << deps.map do |name, requirement|
30
30
  if requirement.respond_to?(:fetch)
31
- requirement = requirement['version'] or next
31
+ requirement = requirement["version"] or next
32
32
  end
33
33
  {
34
34
  name: name,
35
35
  requirement: requirement,
36
- type: index.zero? ? 'runtime' : 'development'
36
+ type: index.zero? ? "runtime" : "development",
37
37
  }
38
38
  end
39
39
  end
@@ -41,14 +41,14 @@ module Bibliothecary
41
41
  parsed_dependencies.flatten.compact
42
42
  end
43
43
 
44
- def self.parse_lockfile(file_contents, options: {})
44
+ def self.parse_lockfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
45
45
  manifest = Tomlrb.parse(file_contents)
46
- manifest.fetch('package',[]).map do |dependency|
47
- next if not dependency['source'] or not dependency['source'].start_with?('registry+')
46
+ manifest.fetch("package",[]).map do |dependency|
47
+ next if not dependency["source"] or not dependency["source"].start_with?("registry+")
48
48
  {
49
- name: dependency['name'],
50
- requirement: dependency['version'],
51
- type: 'runtime'
49
+ name: dependency["name"],
50
+ requirement: dependency["version"],
51
+ type: "runtime",
52
52
  }
53
53
  end
54
54
  .compact
@@ -6,32 +6,32 @@ module Bibliothecary
6
6
  def self.mapping
7
7
  {
8
8
  match_filename("Cartfile") => {
9
- kind: 'manifest',
10
- parser: :parse_cartfile
9
+ kind: "manifest",
10
+ parser: :parse_cartfile,
11
11
  },
12
12
  match_filename("Cartfile.private") => {
13
- kind: 'manifest',
14
- parser: :parse_cartfile_private
13
+ kind: "manifest",
14
+ parser: :parse_cartfile_private,
15
15
  },
16
16
  match_filename("Cartfile.resolved") => {
17
- kind: 'lockfile',
18
- parser: :parse_cartfile_resolved
19
- }
17
+ kind: "lockfile",
18
+ parser: :parse_cartfile_resolved,
19
+ },
20
20
  }
21
21
  end
22
22
 
23
23
  add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV)
24
24
 
25
- def self.parse_cartfile(file_contents, options: {})
26
- map_dependencies(file_contents, 'cartfile')
25
+ def self.parse_cartfile(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
26
+ map_dependencies(file_contents, "cartfile")
27
27
  end
28
28
 
29
- def self.parse_cartfile_private(file_contents, options: {})
30
- map_dependencies(file_contents, 'cartfile.private')
29
+ def self.parse_cartfile_private(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
30
+ map_dependencies(file_contents, "cartfile.private")
31
31
  end
32
32
 
33
- def self.parse_cartfile_resolved(file_contents, options: {})
34
- map_dependencies(file_contents, 'cartfile.resolved')
33
+ def self.parse_cartfile_resolved(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
34
+ map_dependencies(file_contents, "cartfile.resolved")
35
35
  end
36
36
 
37
37
  def self.map_dependencies(manifest, path)
@@ -41,9 +41,9 @@ module Bibliothecary
41
41
 
42
42
  json.map do |dependency|
43
43
  {
44
- name: dependency['name'],
45
- requirement: dependency['version'],
46
- type: dependency["type"]
44
+ name: dependency["name"],
45
+ requirement: dependency["version"],
46
+ type: dependency["type"],
47
47
  }
48
48
  end
49
49
  end
@@ -1,5 +1,5 @@
1
- require 'json'
2
- require 'typhoeus'
1
+ require "json"
2
+ require "typhoeus"
3
3
 
4
4
  module Bibliothecary
5
5
  module Parsers
@@ -9,15 +9,15 @@ module Bibliothecary
9
9
  def self.mapping
10
10
  {
11
11
  match_filename("project.clj") => {
12
- kind: 'manifest',
13
- parser: :parse_manifest
14
- }
12
+ kind: "manifest",
13
+ parser: :parse_manifest,
14
+ },
15
15
  }
16
16
  end
17
17
 
18
18
  add_multi_parser(Bibliothecary::MultiParsers::DependenciesCSV)
19
19
 
20
- def self.parse_manifest(file_contents, options: {})
20
+ def self.parse_manifest(file_contents, options: {}) # rubocop:disable Lint/UnusedMethodArgument
21
21
  response = Typhoeus.post("#{Bibliothecary.configuration.clojars_parser_host}/project.clj", body: file_contents)
22
22
  raise Bibliothecary::RemoteParsingError.new("Http Error #{response.response_code} when contacting: #{Bibliothecary.configuration.clojars_parser_host}/project.clj", response.response_code) unless response.success?
23
23
  json = JSON.parse response.body
@@ -29,7 +29,7 @@ module Bibliothecary
29
29
  {
30
30
  name: dependency[0],
31
31
  requirement: dependency[1],
32
- type: "runtime"
32
+ type: "runtime",
33
33
  }
34
34
  end
35
35
  end