Skip to content

Commit

Permalink
Fix rubocop complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
Dakad committed Jul 28, 2024
1 parent 48729f9 commit 5e5d7bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/grape/validations/validators/length_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def initialize(attrs, options, required, scope, **opts)

raise ArgumentError, 'min must be an integer greater than or equal to zero' if !@min.nil? && (!@min.is_a?(Integer) || @min.negative?)
raise ArgumentError, 'max must be an integer greater than or equal to zero' if !@max.nil? && (!@max.is_a?(Integer) || @max.negative?)
raise ArgumentError, 'exact must be an integer greater than zero' if !@exact.nil? && (!@exact.is_a?(Integer) || !@exact.positive?)
raise ArgumentError, 'exact cannot be combined with min or max' if !@exact.nil? && (!@min.nil? || !@max.nil?)
raise ArgumentError, "min #{@min} cannot be greater than max #{@max}" if !@min.nil? && !@max.nil? && @min > @max

return if @exact.nil?
raise ArgumentError, 'exact must be an integer greater than zero' if !@exact.is_a?(Integer) || !@exact.positive?
raise ArgumentError, 'exact cannot be combined with min or max' if !@min.nil? || !@max.nil?
end

def validate_param!(attr_name, params)
Expand Down

0 comments on commit 5e5d7bc

Please sign in to comment.