YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/resources/validator/BaseValidator.min.js

Summary

Maintainability
A
2 hrs
Test Coverage

Function invokeValidation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

         */invokeValidation:function invokeValidation(field,rules,k,options){//If validation engine already maked the field as error
// we dont want to proceed
if("undefined"==typeof options||!0!==options.isError){var listOfValidators=Vtiger_Base_Validator_Js.getValidator(field);for(var i in listOfValidators){var validatorList=listOfValidators[i],validatorName=validatorList.name,validatorInstance=new validatorName,result=void 0;if(validatorInstance.setElement(field),result=validatorList.hasOwnProperty("params")?validatorInstance.validate(validatorList.params):validatorInstance.validate(),!result)return validatorInstance.getError()}}},/**
Severity: Minor
Found in public_html/layouts/resources/validator/BaseValidator.min.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getValidator has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

         */getValidator:function getValidator(field){var listOfValidators=[],fieldData=field.data(),fieldInfo=fieldData.fieldinfo;"string"==typeof fieldInfo&&(fieldInfo=JSON.parse(fieldInfo));var moduleEle=field.closest("form").find("[name=\"module\"]");!1===Vtiger_Base_Validator_Js.moduleName&&0<moduleEle.length&&(Vtiger_Base_Validator_Js.moduleName=moduleEle.val());var key,value,fieldInstance=Vtiger_Field_Js.getInstance(fieldInfo),validatorsOfType=Vtiger_Base_Validator_Js.getValidatorsFromFieldType(fieldInstance);for(key in validatorsOfType)//IE for loop fix
validatorsOfType.hasOwnProperty(key)&&(value=validatorsOfType[key],""!==value&&listOfValidators.push({name:value}));if(fieldData.hasOwnProperty("validator")){var specialValidators=fieldData.validator;for(var s in specialValidators)//IE for loop fix
if(specialValidators.hasOwnProperty(s)){var specialValidator=specialValidators[s],tempSpecialValidator=jQuery.extend({},specialValidator),validatorOfNames=Vtiger_Base_Validator_Js.getValidatorClassName(specialValidator.name);""!==validatorOfNames&&(tempSpecialValidator.name=validatorOfNames,!jQuery.isEmptyObject(tempSpecialValidator)&&listOfValidators.push(tempSpecialValidator));}}return listOfValidators},/**
Severity: Minor
Found in public_html/layouts/resources/validator/BaseValidator.min.js - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

There are no issues that match your filters.

Category
Status