dependabot-bazel 0.392.0 → 0.394.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0bc8e33d24c59767e7bbbdc09e36298ee43895ece6984032250f4373dd78477
4
- data.tar.gz: f1ec19b81466dc3afed1e298d0d92ad47d1444b4774a004475aca0b9ec0743c3
3
+ metadata.gz: 07e967c98967bc6a340bb069eacda200a20a8a25b9d89ccbae17933bf89f53e5
4
+ data.tar.gz: e592a845112d98402745ba3af8f62cd990916ded84487b3404b514dd5ebee0dc
5
5
  SHA512:
6
- metadata.gz: 560135a611ee640452581bbacee2cc2d78336b030c2c7b95614c5b17ba2b37a9209d253fdfeb3d6ffa51cd3672f80d756aac8b855fbb2037ccb67611511a173d
7
- data.tar.gz: 8975601e9610eb7bc0bbd583590cb87b994bf5ad5220d5f8777b8407107a816336fd992226fdbff82b45251b6e56c8f9eb477c2483e3529cb1e5cfed5e423d4f
6
+ metadata.gz: 975278b8c31dd91c7905788a2590d75e1ec2c5d5451a448cd0763929f6956cc0ab27353ba14ebf1aca4313b8e181f14b7d24a8bad8bb76d268523ecb38340baa
7
+ data.tar.gz: 25b59f72cde9c389f12ea651c1051b33bf91f46f6f999f1b4c22dd72e72590eb94369e139831fddc1dd85853085e3318bee247f7a869ccbeaf5766b63cfc4a54
@@ -1,4 +1,4 @@
1
- # typed: strict
1
+ # typed: strong
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "dependabot/file_fetchers"
@@ -73,7 +73,7 @@ module Dependabot
73
73
  files = T.let([], T::Array[DependencyFile])
74
74
 
75
75
  module_file_items.each do |item|
76
- file = fetch_file_if_present(T.must(item.name))
76
+ file = fetch_file_if_present(item.name)
77
77
  files << file if file
78
78
  end
79
79
 
@@ -10,7 +10,7 @@ module Dependabot
10
10
  module Bazel
11
11
  ECOSYSTEM = "bazel"
12
12
  PACKAGE_MANAGER = "bazel"
13
- DEFAULT_BAZEL_VERSION = "8.4.2"
13
+ DEFAULT_BAZEL_VERSION = "8.5.1"
14
14
 
15
15
  # Keep versions in ascending order
16
16
  SUPPORTED_BAZEL_VERSIONS = T.let([Version.new("6"), Version.new("7")].freeze, T::Array[Dependabot::Version])
@@ -3,6 +3,7 @@
3
3
 
4
4
  require "json"
5
5
  require "base64"
6
+ require "time"
6
7
  require "sorbet-runtime"
7
8
  require "dependabot/shared_helpers"
8
9
  require "dependabot/clients/github_with_retries"
@@ -66,10 +67,8 @@ module Dependabot
66
67
  file_path = "modules/#{module_name}/#{version}/source.json"
67
68
 
68
69
  begin
69
- content = T.unsafe(github_client.contents(GITHUB_REPO, path: file_path))
70
- return nil unless content
71
-
72
- decoded_content = Base64.decode64(content.content)
70
+ content = github_file_content(file_path)
71
+ decoded_content = Base64.decode64(content)
73
72
  JSON.parse(decoded_content)
74
73
  rescue StandardError => e
75
74
  Dependabot.logger.warn("Failed to get source for #{module_name}@#{version}: #{e.message}")
@@ -82,10 +81,7 @@ module Dependabot
82
81
  file_path = "modules/#{module_name}/#{version}/MODULE.bazel"
83
82
 
84
83
  begin
85
- content = T.unsafe(github_client.contents(GITHUB_REPO, path: file_path))
86
- return nil unless content
87
-
88
- Base64.decode64(content.content)
84
+ Base64.decode64(github_file_content(file_path))
89
85
  rescue StandardError => e
90
86
  Dependabot.logger.warn("Failed to get MODULE.bazel for #{module_name}@#{version}: #{e.message}")
91
87
  nil
@@ -102,18 +98,45 @@ module Dependabot
102
98
  file_path = "modules/#{module_name}/#{version}/MODULE.bazel"
103
99
 
104
100
  commits = begin
105
- T.unsafe(github_client).commits("bazelbuild/bazel-central-registry", path: file_path, per_page: 1)
101
+ github_client.commits("bazelbuild/bazel-central-registry", path: file_path, per_page: 1)
106
102
  rescue StandardError => e
107
103
  Dependabot.logger.warn("Failed to get release date for #{module_name} #{version}: #{e.message}")
104
+ nil
108
105
  end
109
106
 
110
- return nil unless commits&.any?
107
+ commit = commits&.first
108
+ return nil unless commit
111
109
 
112
- T.unsafe(commits).first.commit.committer.date
110
+ commit_details = resource_field(commit, :commit, "commit details")
111
+ committer = resource_field(commit_details, :committer, "committer")
112
+ value = T.cast(committer[:date], Object)
113
+ return value if value.is_a?(Time)
114
+ return Time.parse(value) if value.is_a?(String)
115
+
116
+ raise TypeError, "committer date must be a time or string"
113
117
  end
114
118
 
115
119
  private
116
120
 
121
+ sig { params(file_path: String).returns(String) }
122
+ def github_file_content(file_path)
123
+ response = github_client.contents(GITHUB_REPO, path: file_path)
124
+ raise TypeError, "GitHub file response must be an object" unless response.is_a?(Sawyer::Resource)
125
+
126
+ value = T.cast(response[:content], Object)
127
+ return value if value.is_a?(String)
128
+
129
+ raise TypeError, "GitHub file content must be a string"
130
+ end
131
+
132
+ sig { params(resource: Sawyer::Resource, key: Symbol, context: String).returns(Sawyer::Resource) }
133
+ def resource_field(resource, key, context)
134
+ value = T.cast(resource[key], Object)
135
+ return value if value.is_a?(Sawyer::Resource)
136
+
137
+ raise TypeError, "#{context} must be an object"
138
+ end
139
+
117
140
  sig { returns(Dependabot::Clients::GithubWithRetries) }
118
141
  def github_client
119
142
  @github_client ||= T.let(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dependabot-bazel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.392.0
4
+ version: 0.394.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dependabot
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.392.0
18
+ version: 0.394.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.392.0
25
+ version: 0.394.0
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: debug
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -169,14 +169,14 @@ dependencies:
169
169
  requirements:
170
170
  - - "~>"
171
171
  - !ruby/object:Gem::Version
172
- version: '0.22'
172
+ version: '1.1'
173
173
  type: :development
174
174
  prerelease: false
175
175
  version_requirements: !ruby/object:Gem::Requirement
176
176
  requirements:
177
177
  - - "~>"
178
178
  - !ruby/object:Gem::Version
179
- version: '0.22'
179
+ version: '1.1'
180
180
  - !ruby/object:Gem::Dependency
181
181
  name: turbo_tests
182
182
  requirement: !ruby/object:Gem::Requirement
@@ -269,7 +269,7 @@ licenses:
269
269
  - MIT
270
270
  metadata:
271
271
  bug_tracker_uri: https://github.com/dependabot/dependabot-core/issues
272
- changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.392.0
272
+ changelog_uri: https://github.com/dependabot/dependabot-core/releases/tag/v0.394.0
273
273
  rdoc_options: []
274
274
  require_paths:
275
275
  - lib