dependabot-common 0.125.3 → 0.126.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: 6503ed6720842edcb8b8d380c08fde10e8df087b5fdd9a248f357186774f3041
4
- data.tar.gz: 61ceb33331e273dff2d58e212e8d119452cbfdefb1dfcad17128a48def5bd4cb
3
+ metadata.gz: ecc1e4253e33af40deff8d15325f95dc882053d41f524fedfecbbeb376e1535b
4
+ data.tar.gz: 4147c6e094f059963f81408dba61bfbf5f662bc908cb7fbabee2e298ef796c95
5
5
  SHA512:
6
- metadata.gz: a3f02672fec3005896248a24747ee8f8657474ada97cb645aadabc794711ab552684d9ee446320419361be50e91a3b3ccb42fe3104df58c1d984de515cd282ac
7
- data.tar.gz: cfca338692ce6cc5e3a5d289ed245aac3302558080730aa48f6f45ec44c4c47f67603c53c8335277819e68a2458b392df6902f17cff728f0ea13d20b2837e242
6
+ metadata.gz: 1fbb2fcaf11aec409fb4115aba3012a0e143f9ccc10df1ecb24f8295e9746e080edeaa28cac1099cf53657435bc228ff9af0b469ee408bd06b08e553526e2530
7
+ data.tar.gz: 95a45df44655bcccad6d50cdfcf2478a230d7647c4124b20c87876e700b1642f14e6a938a3d4c481e6fae62dafd7771bda541f07a9a12c0ac00387277b3dd946
@@ -8,6 +8,8 @@ module Dependabot
8
8
  class Azure
9
9
  class NotFound < StandardError; end
10
10
 
11
+ MAX_PR_DESCRIPTION_LENGTH = 3999
12
+
11
13
  #######################
12
14
  # Constructor methods #
13
15
  #######################
@@ -154,15 +156,7 @@ module Dependabot
154
156
  # rubocop:disable Metrics/ParameterLists
155
157
  def create_pull_request(pr_name, source_branch, target_branch,
156
158
  pr_description, labels, work_item = nil)
157
- # Azure DevOps only support descriptions up to 4000 characters
158
- # https://developercommunity.visualstudio.com/content/problem/608770/remove-4000-character-limit-on-pull-request-descri.html
159
- azure_max_length = 3999
160
- if pr_description.length > azure_max_length
161
- truncated_msg = "...\n\n_Description has been truncated_"
162
- truncate_length = azure_max_length - truncated_msg.length
163
- pr_description = pr_description[0..truncate_length] + truncated_msg
164
- end
165
- # rubocop:enable Metrics/ParameterLists
159
+ pr_description = truncate_pr_description(pr_description)
166
160
 
167
161
  content = {
168
162
  sourceRefName: "refs/heads/" + source_branch,
@@ -178,6 +172,7 @@ module Dependabot
178
172
  "/_apis/git/repositories/" + source.unscoped_repo +
179
173
  "/pullrequests?api-version=5.0", content.to_json)
180
174
  end
175
+ # rubocop:enable Metrics/ParameterLists
181
176
 
182
177
  def get(url)
183
178
  response = Excon.get(
@@ -230,6 +225,19 @@ module Dependabot
230
225
  end
231
226
  end
232
227
 
228
+ def truncate_pr_description(pr_description)
229
+ # Azure DevOps only support descriptions up to 4000 characters in UTF-16
230
+ # encoding.
231
+ # https://developercommunity.visualstudio.com/content/problem/608770/remove-4000-character-limit-on-pull-request-descri.html
232
+ pr_description = pr_description.dup.force_encoding(Encoding::UTF_16)
233
+ if pr_description.length > MAX_PR_DESCRIPTION_LENGTH
234
+ truncated_msg = "...\n\n_Description has been truncated_".dup.force_encoding(Encoding::UTF_16)
235
+ truncate_length = MAX_PR_DESCRIPTION_LENGTH - truncated_msg.length
236
+ pr_description = (pr_description[0..truncate_length] + truncated_msg)
237
+ end
238
+ pr_description.force_encoding(Encoding::UTF_8)
239
+ end
240
+
233
241
  attr_reader :auth_header
234
242
  attr_reader :credentials
235
243
  attr_reader :source
@@ -7,7 +7,9 @@ module Dependabot
7
7
  module Clients
8
8
  class Bitbucket
9
9
  class NotFound < StandardError; end
10
+
10
11
  class Unauthorized < StandardError; end
12
+
11
13
  class Forbidden < StandardError; end
12
14
 
13
15
  ##########
@@ -88,6 +88,7 @@ module Dependabot
88
88
  end
89
89
 
90
90
  class DependencyFileNotEvaluatable < DependabotError; end
91
+
91
92
  class DependencyFileNotResolvable < DependabotError; end
92
93
 
93
94
  #######################
@@ -226,7 +226,7 @@ module Dependabot
226
226
  previous_commit_shas =
227
227
  github_client.commits(repo, **args).map(&:sha)
228
228
 
229
- # Note: We reverse this so it's consistent with the array we get
229
+ # NOTE: We reverse this so it's consistent with the array we get
230
230
  # from `github_client.compare(...)`
231
231
  args = { sha: new_tag, path: path }.compact
232
232
  github_client.
@@ -13,8 +13,11 @@ module Dependabot
13
13
  require "dependabot/pull_request_creator/labeler"
14
14
 
15
15
  class RepoNotFound < StandardError; end
16
+
16
17
  class RepoArchived < StandardError; end
18
+
17
19
  class RepoDisabled < StandardError; end
20
+
18
21
  class NoHistoryInCommon < StandardError; end
19
22
 
20
23
  # AnnotationError is raised if a PR was created, but failed annotation
@@ -109,19 +109,19 @@ module Dependabot
109
109
  def pull_requests_for_branch
110
110
  @pull_requests_for_branch ||=
111
111
  begin
112
- open_prs = codecommit_client_for_source.pull_requests(
113
- source.repo,
114
- "open",
115
- source.branch || default_branch
116
- )
117
- closed_prs = codecommit_client_for_source.pull_requests(
118
- source.repo,
119
- "closed",
120
- source.branch || default_branch
121
- )
122
-
123
- [*open_prs, *closed_prs]
124
- end
112
+ open_prs = codecommit_client_for_source.pull_requests(
113
+ source.repo,
114
+ "open",
115
+ source.branch || default_branch
116
+ )
117
+ closed_prs = codecommit_client_for_source.pull_requests(
118
+ source.repo,
119
+ "closed",
120
+ source.branch || default_branch
121
+ )
122
+
123
+ [*open_prs, *closed_prs]
124
+ end
125
125
  end
126
126
 
127
127
  def create_commit
@@ -181,7 +181,7 @@ module Dependabot
181
181
  end
182
182
 
183
183
  def self.configure_git_to_use_https
184
- # Note: we use --global here (rather than --system) so that Dependabot
184
+ # NOTE: we use --global here (rather than --system) so that Dependabot
185
185
  # can be run without privileged access
186
186
  run_shell_command(
187
187
  "git config --global --replace-all url.https://github.com/."\
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dependabot
4
- VERSION = "0.125.3"
4
+ VERSION = "0.126.0"
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.125.3
4
+ version: 0.126.0
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-16 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-codecommit
@@ -118,14 +118,14 @@ dependencies:
118
118
  requirements:
119
119
  - - '='
120
120
  - !ruby/object:Gem::Version
121
- version: 4.16.1
121
+ version: 4.17.0
122
122
  type: :runtime
123
123
  prerelease: false
124
124
  version_requirements: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - '='
127
127
  - !ruby/object:Gem::Version
128
- version: 4.16.1
128
+ version: 4.17.0
129
129
  - !ruby/object:Gem::Dependency
130
130
  name: nokogiri
131
131
  requirement: !ruby/object:Gem::Requirement
@@ -292,28 +292,28 @@ dependencies:
292
292
  requirements:
293
293
  - - "~>"
294
294
  - !ruby/object:Gem::Version
295
- version: 0.93.0
295
+ version: 1.5.0
296
296
  type: :development
297
297
  prerelease: false
298
298
  version_requirements: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - "~>"
301
301
  - !ruby/object:Gem::Version
302
- version: 0.93.0
302
+ version: 1.5.0
303
303
  - !ruby/object:Gem::Dependency
304
304
  name: simplecov
305
305
  requirement: !ruby/object:Gem::Requirement
306
306
  requirements:
307
307
  - - "~>"
308
308
  - !ruby/object:Gem::Version
309
- version: 0.19.0
309
+ version: 0.20.0
310
310
  type: :development
311
311
  prerelease: false
312
312
  version_requirements: !ruby/object:Gem::Requirement
313
313
  requirements:
314
314
  - - "~>"
315
315
  - !ruby/object:Gem::Version
316
- version: 0.19.0
316
+ version: 0.20.0
317
317
  - !ruby/object:Gem::Dependency
318
318
  name: simplecov-console
319
319
  requirement: !ruby/object:Gem::Requirement