dependabot-go_modules 0.242.1 → 0.243.0

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: d2dd11ffd8b7957ec28f31f12010179978e646d0b4037be4198c02ee3628a27a
4
- data.tar.gz: e7822126acab8239528098f924441f619bc980aee9b65c690df9584448b58fcd
3
+ metadata.gz: 744d85db0b916488bd45277710d63f2843664dfd6a7134280508dbf47d4e6a1f
4
+ data.tar.gz: e24005d1821ccdafd273d9af42aae6ae2b2eb141c9baa804b213a2e29f78eed0
5
5
  SHA512:
6
- metadata.gz: 699ba8ef172c6d0d76c919b76402a6b9725a84150655559a75c63e7ec6815453b0de32e2eace92e2f33add14dbdb0a6a61faa7c96f141054d32e3c8822f28434
7
- data.tar.gz: 1fdadd754ebf0df2d5ea5f98d2678c590e12f95ad2bd1ea22de33cdd2c636f17b8203d32679152b6f6e7f6b768adc83cfc2ed7aa38e9341523c778a7d157e351
6
+ metadata.gz: 567bd5baf8ffa1edc4f66fdf0f72735761469fa4b497042565582c71296961299e79fa91d536410ef6a4107b02f78f56b4b060ec1faedecf8378540175b96ab8
7
+ data.tar.gz: e955c9a518ce0494cf51960230516602bd0759a6765bf690f1bb340e1df354a7930301d19d6d0ad3e9c5d07927360e1ec1d514dd571846f378cad237f83e47c0
@@ -12,6 +12,8 @@ require "dependabot/utils"
12
12
  module Dependabot
13
13
  module GoModules
14
14
  class Version < Dependabot::Version
15
+ extend T::Sig
16
+
15
17
  VERSION_PATTERN = '[0-9]+[0-9a-zA-Z]*(?>\.[0-9a-zA-Z]+)*' \
16
18
  '(-[0-9A-Za-z-]+(\.[0-9a-zA-Z-]+)*)?' \
17
19
  '(\+incompatible)?'
@@ -28,6 +30,7 @@ module Dependabot
28
30
  @version_string = version.to_s.gsub(/^v/, "")
29
31
  version = version.gsub(/^v/, "") if version.is_a?(String)
30
32
  version = version.to_s.split("+").first if version.to_s.include?("+")
33
+ version, @prerelease = version.to_s.split("-") if version.to_s.include?("-")
31
34
 
32
35
  super
33
36
  end
@@ -39,6 +42,73 @@ module Dependabot
39
42
  def to_s
40
43
  @version_string
41
44
  end
45
+
46
+ def <=>(other)
47
+ result = super(other)
48
+ return if result.nil?
49
+ return result unless result.zero?
50
+
51
+ other = self.class.new(other) unless other.is_a?(Version)
52
+ compare_prerelease(@prerelease || "", T.unsafe(other).prerelease || "")
53
+ end
54
+
55
+ protected
56
+
57
+ attr_reader :prerelease
58
+
59
+ private
60
+
61
+ # This matches Go's semver behavior
62
+ # see https://github.com/golang/mod/blob/fa1ba4269bda724bb9f01ec381fbbaf031e45833/semver/semver.go#L333
63
+ # rubocop:disable Metrics/CyclomaticComplexity
64
+ # rubocop:disable Metrics/PerceivedComplexity
65
+ def compare_prerelease(left, right)
66
+ return 0 if left == right
67
+ return 1 if left == ""
68
+ return -1 if right == ""
69
+
70
+ while left != "" && right != ""
71
+ left = left[1..-1] if left.start_with?(".", "-")
72
+ right = right[1..-1] if right.start_with?(".", "-")
73
+
74
+ dx, left = next_ident(left)
75
+ dy, right = next_ident(right)
76
+ next unless dx != dy
77
+
78
+ ix = num?(dx)
79
+ iy = num?(dy)
80
+ if ix != iy
81
+ return -1 if ix
82
+
83
+ return 1
84
+ end
85
+ if ix
86
+ return -1 if dx.length < dy.length
87
+ return 1 if dx.length > dy.length
88
+ end
89
+ return -1 if dx < dy
90
+
91
+ return 1
92
+
93
+ end
94
+ return -1 if left == ""
95
+
96
+ 1
97
+ end
98
+ # rubocop:enable Metrics/CyclomaticComplexity
99
+ # rubocop:enable Metrics/PerceivedComplexity
100
+
101
+ def next_ident(data)
102
+ i = 0
103
+ i += 1 while i < data.length && data[i] != "."
104
+ [data[0..i], data[i..-1]]
105
+ end
106
+
107
+ def num?(data)
108
+ i = 0
109
+ i += 1 while i < data.length && data[i] >= "0" && data[i] <= "9"
110
+ i == data.length
111
+ end
42
112
  end
43
113
  end
44
114
  end
@@ -18,6 +18,3 @@ Dependabot::PullRequestCreator::Labeler
18
18
  require "dependabot/dependency"
19
19
  Dependabot::Dependency
20
20
  .register_production_check("go_modules", ->(_) { true })
21
-
22
- require "dependabot/utils"
23
- Dependabot::Utils.register_always_clone("go_modules")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-go_modules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.242.1
4
+ version: 0.243.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-23 00:00:00.000000000 Z
11
+ date: 2024-02-13 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.242.1
19
+ version: 0.243.0
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.242.1
26
+ version: 0.243.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debug
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -253,7 +253,7 @@ licenses:
253
253
  - Nonstandard
254
254
  metadata:
255
255
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
256
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.242.1
256
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.243.0
257
257
  post_install_message:
258
258
  rdoc_options: []
259
259
  require_paths: