Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring.
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Function SessionPrompt
has 67 lines of code (exceeds 25 allowed). Consider refactoring.
const SessionPrompt = (function () {
let settings = {
SECOND: 1000
};
Class FormCollectionProxy
has 22 methods (exceeds 20 allowed). Consider refactoring.
class FormCollectionProxy
include Enumerable
def initialize(child_form_class_name, collection_name, parent_form_instance)
@parent_form_instance = parent_form_instance
Method but_skip_postcode_validation
has 29 lines of code (exceeds 25 allowed). Consider refactoring.
def self.but_skip_postcode_validation
Module.new do
extend ActiveSupport::Concern
const_set :ADDRESS_LINE_LENGTH, 50
Function SessionPrompt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
const SessionPrompt = (function () {
let settings = {
SECOND: 1000
};
Method illegal_date?
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
def illegal_date?(record, attribute, value)
raw_value = read_attribute_before_type_cast(record, attribute, default: nil)
if raw_value.is_a?(String) && raw_value.blank?
Method date_is_past?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
def date_is_past?
return if end_date.blank? || start_date.blank?
return unless end_date.is_a?(Date) && start_date.is_a?(Date)
errors.add(:start_date, :date_in_future) if Time.zone.today < start_date
Method start_date_before_notice_period_end_date?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def start_date_before_notice_period_end_date?
return if notice_period_end_date.blank? || start_date.blank?
return unless notice_period_end_date.is_a?(Date) && start_date.is_a?(Date)
return unless notice_period_end_date < start_date
Method end_date_before_start_date?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def end_date_before_start_date?
return if end_date.blank? || start_date.blank?
return unless end_date.is_a?(Date) && start_date.is_a?(Date)
return unless end_date < start_date
Method new_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
def new_date(year, mon, mday = nil)
mday ||= 1 if omit_day
year = (1900 + year.to_i).to_s if allow_2_digit_year && year.present? && year.strip.length <= 2
Date.strptime("#{year}-#{mon}-#{mday}", '%Y-%m-%d')
rescue ::Date::Error, TypeError
Method value_from_multiparameter_assignment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def value_from_multiparameter_assignment(value)
if value.is_a?(Hash)
value = value.stringify_keys if value.respond_to?(:stringify_keys)
begin
super(1 => value['year'], 2 => value['month'], 3 => value['day'])
Method illegal_year?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
def illegal_year?(value)
return false if value.nil?
case value
Function monitorDownloadLink
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
function monitorDownloadLink() {
const successNode = document.querySelector('.pdf-success');
const failureNode = document.querySelector('.pdf-failure');
const url = successNode.getAttribute('href')
let http = new XMLHttpRequest();