GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Push — master ( 1d1cc0...0cc886 )
by Leonardo
01:05
created

IbanValidator.validate_each()   B

Complexity

Conditions 6

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 6
c 1
b 0
f 0
dl 0
loc 11
rs 8
1
# frozen_string_literal: true
2
3
require "active_model/validations"
4
require "iban_bic"
5
6
# ActiveModel Rails module.
7
module ActiveModel
8
  # ActiveModel::Validations Rails module. Contains all the default validators.
9
  module Validations
10
    class IbanValidator < ActiveModel::EachValidator
11
      def validate_each(record, attribute, value)
12
        if !IbanBic.parse(value)
13
          record.errors.add(attribute, :invalid_format)
14
        elsif !IbanBic.valid_check?(value)
15
          record.errors.add(attribute, :invalid_check)
16
        elsif !IbanBic.valid_country_check?(value)
17
          record.errors.add(attribute, :invalid_country_check)
18
        elsif options[:tags] && !IbanBic.has_tags?(value, options[:tags])
19
          record.errors.add(attribute, :invalid_tag)
20
        end
21
      end
22
    end
23
  end
24
end
25