bibliothecary 8.7.1 → 8.7.3

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: 7f6b75ad41b078c913dc3170bba3fa22d3d885b17e3c27e961f9b5e084d539c7
4
- data.tar.gz: 8354e96eb6e2473549e4cbae545a6a9d80fbb9dc49965a0cb75cc66a1e5aa5ca
3
+ metadata.gz: 9d0f05bf5e90424caec70a51181e2fcdeef5ad3ba8ab03109cd765f2ea2943b0
4
+ data.tar.gz: e40d4ab5813287042f421c719df563869f2a6b3b8647d038e666b4e2bfc830c7
5
5
  SHA512:
6
- metadata.gz: f6ab5428cbf33ca11c0013b1af6b0c0314141af095cef19921ebddbbb2ada7db7d6534768be658ff2408a6cc8ce94b84cdf8038ecd75449a3bdc20860a329d62
7
- data.tar.gz: 1c5ebfcbf76c589345a818b9a4f2a463a52aca2d2ed3fb0fb90d9b77644ac1b9a0262fb4a38c8f08fabfabb4561c1f2b14d4692e149e3fb0af0092d028b9d117
6
+ metadata.gz: 279dd423656e36ce95d8ef56f4c6377019b8f101d2d57c71c8fcecba09c62bb2bb50deb0b98f996045f79f798021ef0eadaae351b2cfc5ca3ca9ad8b78fc80f4
7
+ data.tar.gz: 52e317e720768a405d9f2c77e1f855a025274da31b8460784524cff825715f19b58be1f158505de099c026e8ed292bd7008ec8a468bb733bba1e7787294e248b
@@ -42,7 +42,7 @@ module Bibliothecary
42
42
 
43
43
  dependencies_to_analysis(info, kind, dependencies)
44
44
  rescue Bibliothecary::FileParsingError => e
45
- Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, kind, e.message)
45
+ Bibliothecary::Analyser::create_error_analysis(platform_name, info.relative_path, kind, e.message, e.location)
46
46
  end
47
47
  alias analyze_contents_from_info analyse_contents_from_info
48
48
 
@@ -84,7 +84,10 @@ module Bibliothecary
84
84
 
85
85
  rescue Exception => e # default is StandardError but C bindings throw Exceptions
86
86
  # the C xml parser also puts a newline at the end of the message
87
- raise Bibliothecary::FileParsingError.new(e.message.strip, filename)
87
+ location = e.backtrace_locations[0]
88
+ .to_s
89
+ .then { |l| l =~ /bibliothecary\// ? l.split("bibliothecary/").last : l.split("gems/").last }
90
+ raise Bibliothecary::FileParsingError.new(e.message.strip, filename, location)
88
91
  end
89
92
 
90
93
  private
@@ -4,14 +4,15 @@ require_relative './analyser/analysis.rb'
4
4
 
5
5
  module Bibliothecary
6
6
  module Analyser
7
- def self.create_error_analysis(platform_name, relative_path, kind, message)
7
+ def self.create_error_analysis(platform_name, relative_path, kind, message, location=nil)
8
8
  {
9
9
  platform: platform_name,
10
10
  path: relative_path,
11
11
  dependencies: nil,
12
12
  kind: kind,
13
13
  success: false,
14
- error_message: message
14
+ error_message: message,
15
+ error_location: location,
15
16
  }
16
17
  end
17
18
 
@@ -8,9 +8,10 @@ module Bibliothecary
8
8
  end
9
9
 
10
10
  class FileParsingError < StandardError
11
- attr_accessor :filename
12
- def initialize(msg, filename)
11
+ attr_accessor :filename, :location
12
+ def initialize(msg, filename, location=nil)
13
13
  @filename = filename
14
+ @location = location # source code location of the error, e.g. "lib/hi.rb:34"
14
15
  msg = "#{filename}: #{msg}" unless msg.include?(filename)
15
16
  super("#{msg}")
16
17
  end
@@ -254,6 +254,10 @@ module Bibliothecary
254
254
  end
255
255
 
256
256
  def self.parse_resolved_dep_line(line)
257
+ # filter out anything that doesn't look like a
258
+ # resolved dep line
259
+ return unless line[/ .*:[^-]+-- /]
260
+
257
261
  dep_parts = line.strip.split(":")
258
262
  return unless dep_parts.length == 5
259
263
  # org.springframework.boot:spring-boot-starter-web:jar:2.0.3.RELEASE:compile -- module spring.boot.starter.web [auto]
@@ -365,6 +369,8 @@ module Bibliothecary
365
369
 
366
370
  value = field.nodes.first
367
371
  value = value.value if value.is_a?(Ox::CData)
372
+ # whitespace in dependency tags should be ignored
373
+ value = value&.strip
368
374
  match = value&.match(MAVEN_PROPERTY_REGEX)
369
375
  if match
370
376
  return extract_property(xml, match[1], value, parent_properties)
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "8.7.1"
2
+ VERSION = "8.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bibliothecary
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.7.1
4
+ version: 8.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-06 00:00:00.000000000 Z
11
+ date: 2023-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb