Class: FindMaxNumViolations
- Inherits:
-
Object
- Object
- FindMaxNumViolations
- Defined in:
- lib/danger/helpers/find_max_num_violations.rb
Overview
Find max_num_violations in lib/danger/comment_generators/github.md.erb.
Constant Summary collapse
- LIMIT =
Save ~ 5000 for contents other than violations to avoid exceeded 65536 max comment length limit.
60_000
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(violations) ⇒ FindMaxNumViolations
constructor
A new instance of FindMaxNumViolations.
Constructor Details
#initialize(violations) ⇒ FindMaxNumViolations
Returns a new instance of FindMaxNumViolations.
6 7 8 |
# File 'lib/danger/helpers/find_max_num_violations.rb', line 6 def initialize(violations) @violations = violations end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/danger/helpers/find_max_num_violations.rb', line 10 def call total = 0 num_of_violations_allowed = 0 violations.each do |violation| = violation..length + 80 # 80 is ~ the size of html wraps violation message. if total + < LIMIT total += num_of_violations_allowed += 1 else break end end num_of_violations_allowed end |