danger 4.0.4 → 4.0.5

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
  SHA1:
3
- metadata.gz: 4a944b517b8e33c5204a68e0380be5f0066b8df5
4
- data.tar.gz: aeb83608871b332acba8321c43157893ade21a1d
3
+ metadata.gz: 2b38a6e168e6dcf728c7b4b6f21508898d541403
4
+ data.tar.gz: ff70b2d646014a8ad369e5ed58a8e8a23ff8fdd7
5
5
  SHA512:
6
- metadata.gz: 1ca07fc21a6fc3168a8ab9db590017b90dc2872a49f536046646269e209acb19ff56df18f7103dee270c94f169ce283b1ea49be7808e64aedc7c075e9cc2d6c4
7
- data.tar.gz: bc1ac336880de4d918c3da36351c49506c692fe12c17b3632a7fc496109395c7066e687da3c8791ec626dd02860354eac06da59cd756719fe96f28e1ca5d2300
6
+ metadata.gz: c1e063484128d9082a71d2988b8204a5161b8311935979997c120d03b30c4cc4110617f9d2a908826538bb406e59046299136058b3bf90ab023724ceae2d89c9
7
+ data.tar.gz: 4330a18b4774180d562017580484e3bc7fe9f6e97cf54f10611b86f0bc2f20938bfe4400ce4637c45564a4c5162b0b142cfef6a7374183e68ff3daa73222a870
@@ -116,7 +116,15 @@ module Danger
116
116
 
117
117
  def client
118
118
  require "octokit"
119
- Octokit::Client.new(access_token: ENV["DANGER_GITHUB_API_TOKEN"])
119
+ Octokit::Client.new(access_token: ENV["DANGER_GITHUB_API_TOKEN"], api_endpoint: api_url)
120
+ end
121
+
122
+ def api_url
123
+ ENV.fetch("DANGER_GITHUB_API_HOST") do
124
+ ENV.fetch("DANGER_GITHUB_API_BASE_URL") do
125
+ "https://api.github.com/".freeze
126
+ end
127
+ end
120
128
  end
121
129
  end
122
130
  end
@@ -14,7 +14,7 @@
14
14
  </tr>
15
15
  </thead>
16
16
  <tbody>
17
- <%- max_num_violations = 700 -%>
17
+ <%- max_num_violations = FindMaxNumViolations.new(table[:content]).call -%>
18
18
  <%- table[:content].take(max_num_violations).each do |violation| -%>
19
19
  <tr>
20
20
  <td>:<%= table[:emoji] %>:</td>
@@ -1,6 +1,7 @@
1
1
  require "kramdown"
2
2
  require "danger/helpers/comments_parsing_helper"
3
3
  require "danger/helpers/emoji_mapper"
4
+ require "danger/helpers/find_max_num_violations"
4
5
 
5
6
  # rubocop:disable Metrics/ModuleLength
6
7
 
@@ -0,0 +1,31 @@
1
+ # Find max_num_violations in lib/danger/comment_generators/github.md.erb.
2
+ class FindMaxNumViolations
3
+ # Save ~ 5000 for contents other than violations to avoid exceeded 65536 max comment length limit.
4
+ LIMIT = 60_000
5
+
6
+ def initialize(violations)
7
+ @violations = violations
8
+ end
9
+
10
+ def call
11
+ total = 0
12
+ num_of_violations_allowed = 0
13
+
14
+ violations.each do |violation|
15
+ message_length = violation.message.length + 80 # 80 is ~ the size of html wraps violation message.
16
+
17
+ if total + message_length < LIMIT
18
+ total += message_length
19
+ num_of_violations_allowed += 1
20
+ else
21
+ break
22
+ end
23
+ end
24
+
25
+ num_of_violations_allowed
26
+ end
27
+
28
+ private
29
+
30
+ attr_reader :violations
31
+ end
@@ -353,8 +353,8 @@ module Danger
353
353
  end
354
354
 
355
355
  # We are past the line position, just abort
356
- break if message.line < range_start
357
- next unless message.line >= range_start && message.line <= range_end
356
+ break if message.line.to_i < range_start
357
+ next unless message.line.to_i >= range_start && message.line.to_i <= range_end
358
358
 
359
359
  file_line = range_start
360
360
  end
@@ -1,4 +1,4 @@
1
1
  module Danger
2
- VERSION = "4.0.4".freeze
2
+ VERSION = "4.0.5".freeze
3
3
  DESCRIPTION = "Like Unit Tests, but for your Team Culture.".freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.4
4
+ version: 4.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-12-29 00:00:00.000000000 Z
12
+ date: 2017-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: claide
@@ -422,6 +422,7 @@ files:
422
422
  - lib/danger/helpers/comments_helper.rb
423
423
  - lib/danger/helpers/comments_parsing_helper.rb
424
424
  - lib/danger/helpers/emoji_mapper.rb
425
+ - lib/danger/helpers/find_max_num_violations.rb
425
426
  - lib/danger/plugin_support/gems_resolver.rb
426
427
  - lib/danger/plugin_support/plugin.rb
427
428
  - lib/danger/plugin_support/plugin_file_resolver.rb