dependabot-common 0.145.3 → 0.147.1

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: e529a98656bc4faab2c6e8e0b27cb487b272f0eb1e7a0a6b24c378917eb7fc0c
4
- data.tar.gz: 1114132591919b93cc7a6ae9abd16f631028f7a6e21c523e0ceef94f4a8ea303
3
+ metadata.gz: abae304f54068dfcec44e81919bc0f3290fdfb5ecf0ee9f5f878c8612902315b
4
+ data.tar.gz: 75018dbfb55e8d3100e863064e7fc1b913cdc8b3b091722b06b307bd94968ee8
5
5
  SHA512:
6
- metadata.gz: f47c6bcd3b685350199f6d724a711b5cee21375f76b65886550b82e3bd4485f0291807bac563ed24401c168f49b2c2d1da9856eecd8091e00b95030e96f61b78
7
- data.tar.gz: 11f85cb1b184c490be8b969419f7ceedb4c61e9e17792ee077bfac738d1bdc5f4a35145cd17915519cc212c5068789e72c9eb7b95c952f3731ba04ed0cadf546
6
+ metadata.gz: 0b33fd489354101454ad3ea6a549d3080f47965bd1e8c200b1b380ae22ad219f759b02963d4d7f35f1bfaec97ad2b02dce1494033f89bfc081d2371b74603dfa
7
+ data.tar.gz: 48311e053bb7efa1be238da5819a86b379fa864e7c23aa4592ff48fa5baa807b982e056b5dd3f8a9bc260addaad552eb5ca00b8565d3133d8435e14937deb026
@@ -60,10 +60,10 @@ module Dependabot
60
60
  end
61
61
 
62
62
  def pinned_ref_looks_like_commit_sha?
63
- return false unless pinned?
64
-
65
63
  ref = dependency_source_details.fetch(:ref)
66
- return false unless ref.match?(/^[0-9a-f]{6,40}$/)
64
+ return false unless ref&.match?(/^[0-9a-f]{6,40}$/)
65
+
66
+ return false unless pinned?
67
67
 
68
68
  local_repo_git_metadata_fetcher.head_commit_for_ref(ref).nil?
69
69
  end
@@ -87,13 +87,16 @@ module Dependabot
87
87
  end
88
88
 
89
89
  # rubocop:disable Metrics/PerceivedComplexity
90
+ # rubocop:disable Metrics/AbcSize
90
91
  def local_tag_for_latest_version
91
92
  tags =
92
93
  local_tags.
93
94
  select { |t| version_tag?(t.name) && matches_existing_prefix?(t.name) }
94
95
  filtered = tags.
95
96
  reject { |t| tag_included_in_ignore_requirements?(t) }
96
- raise Dependabot::AllVersionsIgnored if @raise_on_ignored && tags.any? && filtered.empty?
97
+ if @raise_on_ignored && filter_lower_versions(filtered).empty? && filter_lower_versions(tags).any?
98
+ raise Dependabot::AllVersionsIgnored
99
+ end
97
100
 
98
101
  tag = filtered.
99
102
  reject { |t| tag_is_prerelease?(t) && !wants_prerelease? }.
@@ -113,8 +116,40 @@ module Dependabot
113
116
  tag_sha: tag.tag_sha
114
117
  }
115
118
  end
119
+ # rubocop:enable Metrics/AbcSize
116
120
  # rubocop:enable Metrics/PerceivedComplexity
117
121
 
122
+ def current_version
123
+ return unless dependency.version && version_tag?(dependency.version)
124
+
125
+ version = dependency.version.match(VERSION_REGEX).named_captures.fetch("version")
126
+ version_class.new(version)
127
+ end
128
+
129
+ def filter_lower_versions(tags)
130
+ return tags unless current_version
131
+
132
+ versions = tags.map do |t|
133
+ version = t.name.match(VERSION_REGEX).named_captures.fetch("version")
134
+ version_class.new(version)
135
+ end
136
+
137
+ versions.select do |version|
138
+ version > current_version
139
+ end
140
+ end
141
+
142
+ def local_tag_for_pinned_version
143
+ return unless pinned?
144
+
145
+ ref = dependency_source_details.fetch(:ref)
146
+ tags = local_tags.select { |t| t.commit_sha == ref && version_class.correct?(t.name) }.
147
+ sort_by { |t| version_class.new(t.name) }
148
+ return if tags.empty?
149
+
150
+ tags[-1].name
151
+ end
152
+
118
153
  def git_repo_reachable?
119
154
  local_upload_pack
120
155
  true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.145.3"
4
+ VERSION = "0.147.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.145.3
4
+ version: 0.147.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-07 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -298,14 +298,14 @@ dependencies:
298
298
  requirements:
299
299
  - - "~>"
300
300
  - !ruby/object:Gem::Version
301
- version: 1.14.0
301
+ version: 1.15.0
302
302
  type: :development
303
303
  prerelease: false
304
304
  version_requirements: !ruby/object:Gem::Requirement
305
305
  requirements:
306
306
  - - "~>"
307
307
  - !ruby/object:Gem::Version
308
- version: 1.14.0
308
+ version: 1.15.0
309
309
  - !ruby/object:Gem::Dependency
310
310
  name: simplecov
311
311
  requirement: !ruby/object:Gem::Requirement