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.
Passed
Push — master ( a0bee1...5f7af5 )
by Leonardo
01:28
created

BicValidator   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A validate_each() 0 6 3
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 BicValidator < ActiveModel::EachValidator
11
      def validate_each(record, attribute, value)
12
        country_field = options[:country] ? record[options[:country]] : "[A-Z]{2}"
13
        unless /[A-Z]{4}#{country_field}[0-9A-Z]{2,5}/.match? value.upcase
14
          record.errors.add(attribute, :invalid_format)
15
        end
16
      end
17
    end
18
  end
19
end
20