dependabot-hex 0.124.8 → 0.125.4

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: 44116ef9d9350b3e9c6c347ef140398e4d75e4acc20dced2eb936191ce488467
4
- data.tar.gz: 0b6fc045350ece81628bdcd883ce039d1afaf06de870aa082c650e3114b651de
3
+ metadata.gz: 4514812b744c1288d304046819c4e6db1e6a24b27df591940af5152e86b1a180
4
+ data.tar.gz: 939f8554255133a76020b4215323197535f5f24d799efbaf210c448325bc3ec9
5
5
  SHA512:
6
- metadata.gz: c5694e2aad34b663b6e65de7ef7a5cd605f22f06125f3d28b6fece720dd914aa097588db7e801ff42a0e3af0e37f6ddd3dc0bbc2d249f182bfa59ef7a9fe0cac
7
- data.tar.gz: b144a8c1c70db7a3503ba798b3f4a9ea097b1d897e5aad471bf9b9003c5412859544e813e90b1561b13186b0746310223e7ee1a024351fb786cbd711ff0df0cc
6
+ metadata.gz: 257971551d23fd78234a61198bd7750b9728ad11de8fbeed143a0535c736bfaf1fae9fbfea35744d12e9a4c9141a38798bf303c075eb5217c773afbfc3b1adfa
7
+ data.tar.gz: 63ca6de9f50963df2f4a982b478eb7c0123e5b2c46887ef20c13fc29940442c14b1e080e955c98c5179a2fe5c79b80d0f25e28928d7eed1c20ce4dc8571339d9
@@ -8,8 +8,9 @@ module Dependabot
8
8
  class FileFetcher < Dependabot::FileFetchers::Base
9
9
  APPS_PATH_REGEX = /apps_path:\s*"(?<path>.*?)"/m.freeze
10
10
  STRING_ARG = %{(?:["'](.*?)["'])}
11
- EVAL_FILE = /Code\.eval_file\(#{STRING_ARG}(?:\s*,\s*#{STRING_ARG})?\)/.
12
- freeze
11
+ SUPPORTED_METHODS = %w(eval_file require_file).join("|").freeze
12
+ SUPPORT_FILE = /Code\.(?:#{SUPPORTED_METHODS})\(#{STRING_ARG}(?:\s*,\s*#{STRING_ARG})?\)/.
13
+ freeze
13
14
 
14
15
  def self.required_files_in?(filenames)
15
16
  filenames.include?("mix.exs")
@@ -26,7 +27,7 @@ module Dependabot
26
27
  fetched_files << mixfile
27
28
  fetched_files << lockfile if lockfile
28
29
  fetched_files += subapp_mixfiles
29
- fetched_files += evaled_files
30
+ fetched_files += support_files
30
31
  fetched_files
31
32
  end
32
33
 
@@ -66,9 +67,9 @@ module Dependabot
66
67
  []
67
68
  end
68
69
 
69
- def evaled_files
70
- mixfile.content.scan(EVAL_FILE).map do |eval_file_args|
71
- path = Pathname.new(File.join(*eval_file_args.reverse)).
70
+ def support_files
71
+ mixfile.content.scan(SUPPORT_FILE).map do |support_file_args|
72
+ path = Pathname.new(File.join(*support_file_args.compact.reverse)).
72
73
  cleanpath.to_path
73
74
  fetch_file_from_host(path).tap { |f| f.support_file = true }
74
75
  end
@@ -42,7 +42,7 @@ module Dependabot
42
42
  def dependency_details
43
43
  SharedHelpers.in_a_temporary_directory do
44
44
  write_sanitized_mixfiles
45
- write_supporting_files
45
+ write_sanitized_supporting_files
46
46
  File.write("mix.lock", lockfile.content) if lockfile
47
47
  FileUtils.cp(elixir_helper_parse_deps_path, "parse_deps.exs")
48
48
 
@@ -73,11 +73,11 @@ module Dependabot
73
73
  end
74
74
  end
75
75
 
76
- def write_supporting_files
76
+ def write_sanitized_supporting_files
77
77
  dependency_files.select(&:support_file).each do |file|
78
78
  path = file.name
79
79
  FileUtils.mkdir_p(Pathname.new(path).dirname)
80
- File.write(path, file.content)
80
+ File.write(path, sanitize_mixfile(file.content))
81
81
  end
82
82
  end
83
83
 
@@ -66,7 +66,7 @@ module Dependabot
66
66
  dependency_files.select(&:support_file).each do |file|
67
67
  path = file.name
68
68
  FileUtils.mkdir_p(Pathname.new(path).dirname)
69
- File.write(path, file.content)
69
+ File.write(path, sanitize_mixfile(file.content))
70
70
  end
71
71
  end
72
72
 
@@ -18,9 +18,7 @@ module Dependabot
18
18
  def updated_content
19
19
  updated_content = update_pin(mixfile_content)
20
20
 
21
- if content_should_change? && mixfile_content == updated_content
22
- raise "Expected content to change!"
23
- end
21
+ raise "Expected content to change!" if content_should_change? && mixfile_content == updated_content
24
22
 
25
23
  updated_content
26
24
  end
@@ -20,9 +20,7 @@ module Dependabot
20
20
  def updated_content
21
21
  updated_content = update_requirement(mixfile_content)
22
22
 
23
- if content_should_change? && mixfile_content == updated_content
24
- raise "Expected content to change!"
25
- end
23
+ raise "Expected content to change!" if content_should_change? && mixfile_content == updated_content
26
24
 
27
25
  updated_content
28
26
  end
@@ -68,9 +68,7 @@ module Dependabot
68
68
  def latest_resolvable_version_for_git_dependency
69
69
  # If the gem isn't pinned, the latest version is just the latest
70
70
  # commit for the specified branch.
71
- unless git_commit_checker.pinned?
72
- return latest_resolvable_commit_with_unchanged_git_source
73
- end
71
+ return latest_resolvable_commit_with_unchanged_git_source unless git_commit_checker.pinned?
74
72
 
75
73
  # If the dependency is pinned to a tag that looks like a version then
76
74
  # we want to update that tag. The latest version will then be the SHA
@@ -103,9 +101,7 @@ module Dependabot
103
101
  def latest_git_version_sha
104
102
  # If the gem isn't pinned, the latest version is just the latest
105
103
  # commit for the specified branch.
106
- unless git_commit_checker.pinned?
107
- return git_commit_checker.head_commit_for_current_branch
108
- end
104
+ return git_commit_checker.head_commit_for_current_branch unless git_commit_checker.pinned?
109
105
 
110
106
  # If the dependency is pinned to a tag that looks like a version then
111
107
  # we want to update that tag. The latest version will then be the SHA
@@ -225,9 +221,7 @@ module Dependabot
225
221
  ignore_reqs.any? { |r| r.satisfied_by?(v) }
226
222
  end
227
223
 
228
- if @raise_on_ignored && filtered.empty? && versions.any?
229
- raise AllVersionsIgnored
230
- end
224
+ raise AllVersionsIgnored if @raise_on_ignored && filtered.empty? && versions.any?
231
225
 
232
226
  filtered.max
233
227
  end
@@ -54,14 +54,10 @@ module Dependabot
54
54
  def mixfile_content_for_update_check(file)
55
55
  content = file.content
56
56
 
57
- unless dependency_appears_in_file?(file.name)
58
- return sanitize_mixfile(content)
59
- end
57
+ return sanitize_mixfile(content) unless dependency_appears_in_file?(file.name)
60
58
 
61
59
  content = relax_version(content, filename: file.name)
62
- if replace_git_pin?
63
- content = replace_git_pin(content, filename: file.name)
64
- end
60
+ content = replace_git_pin(content, filename: file.name) if replace_git_pin?
65
61
 
66
62
  sanitize_mixfile(content)
67
63
  end
@@ -85,9 +81,7 @@ module Dependabot
85
81
  lower_bound_req = updated_version_req_lower_bound(filename)
86
82
 
87
83
  return lower_bound_req if latest_allowable_version.nil?
88
- unless version_class.correct?(latest_allowable_version)
89
- return lower_bound_req
90
- end
84
+ return lower_bound_req unless version_class.correct?(latest_allowable_version)
91
85
 
92
86
  lower_bound_req + " and <= #{latest_allowable_version}"
93
87
  end
@@ -54,9 +54,7 @@ module Dependabot
54
54
  update_mixfile_range(last_string_reqs).map(&:to_s).join(" and ")
55
55
  end
56
56
 
57
- if or_string_reqs.count > 1
58
- new_requirement = req[:requirement] + " or " + new_requirement
59
- end
57
+ new_requirement = req[:requirement] + " or " + new_requirement if or_string_reqs.count > 1
60
58
 
61
59
  req.merge(requirement: new_requirement)
62
60
  end
@@ -66,9 +64,7 @@ module Dependabot
66
64
  def update_source(requirement_hash)
67
65
  # Only git sources ever need to be updated. Anything else should be
68
66
  # left alone.
69
- unless requirement_hash.dig(:source, :type) == "git"
70
- return requirement_hash
71
- end
67
+ return requirement_hash unless requirement_hash.dig(:source, :type) == "git"
72
68
 
73
69
  requirement_hash.merge(source: updated_source)
74
70
  end
@@ -31,7 +31,7 @@ module Dependabot
31
31
  def fetch_latest_resolvable_version
32
32
  latest_resolvable_version =
33
33
  SharedHelpers.in_a_temporary_directory do
34
- write_temporary_dependency_files
34
+ write_temporary_sanitized_dependency_files
35
35
  FileUtils.cp(
36
36
  elixir_helper_check_update_path,
37
37
  "check_update.exs"
@@ -43,9 +43,7 @@ module Dependabot
43
43
  end
44
44
 
45
45
  return if latest_resolvable_version.nil?
46
- if latest_resolvable_version.match?(/^[0-9a-f]{40}$/)
47
- return latest_resolvable_version
48
- end
46
+ return latest_resolvable_version if latest_resolvable_version.match?(/^[0-9a-f]{40}$/)
49
47
 
50
48
  version_class.new(latest_resolvable_version)
51
49
  rescue SharedHelpers::HelperSubprocessFailed => e
@@ -111,7 +109,7 @@ module Dependabot
111
109
 
112
110
  def check_original_requirements_resolvable
113
111
  SharedHelpers.in_a_temporary_directory do
114
- write_temporary_dependency_files(prepared: false)
112
+ write_temporary_sanitized_dependency_files(prepared: false)
115
113
  FileUtils.cp(
116
114
  elixir_helper_check_update_path,
117
115
  "check_update.exs"
@@ -127,7 +125,7 @@ module Dependabot
127
125
  raise Dependabot::DependencyFileNotResolvable, e.message
128
126
  end
129
127
 
130
- def write_temporary_dependency_files(prepared: true)
128
+ def write_temporary_sanitized_dependency_files(prepared: true)
131
129
  files = if prepared then prepared_dependency_files
132
130
  else original_dependency_files
133
131
  end
@@ -135,12 +133,7 @@ module Dependabot
135
133
  files.each do |file|
136
134
  path = file.name
137
135
  FileUtils.mkdir_p(Pathname.new(path).dirname)
138
-
139
- if file.name.end_with?("mix.exs")
140
- File.write(path, sanitize_mixfile(file.content))
141
- else
142
- File.write(path, file.content)
143
- end
136
+ File.write(path, sanitize_mixfile(file.content))
144
137
  end
145
138
  end
146
139
 
@@ -24,9 +24,7 @@ module Dependabot
24
24
  def initialize(version)
25
25
  @version_string = version.to_s
26
26
 
27
- if version.to_s.include?("+")
28
- version, @build_info = version.to_s.split("+")
29
- end
27
+ version, @build_info = version.to_s.split("+") if version.to_s.include?("+")
30
28
 
31
29
  super
32
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-hex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.124.8
4
+ version: 0.125.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-04 00:00:00.000000000 Z
11
+ date: 2020-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dependabot-common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.124.8
19
+ version: 0.125.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.124.8
26
+ version: 0.125.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: 0.7.2
131
+ version: 0.8.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: 0.7.2
138
+ version: 0.8.0
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: vcr
141
141
  requirement: !ruby/object:Gem::Requirement