Showing 16 of 26 total issues
Function CNPJ
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
export default function CNPJ(cnpj)
{
this.validate = () =>
{
let value = this.clear();
- Read upRead up
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 CPF
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function CPF(cpf)
{
this.validate = () =>
{
let value = this.clear();
- Read upRead up
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 CPF
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function CPF(cpf)
{
this.validate = () =>
{
let value = this.clear();
Function CNPJ
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function CNPJ(cnpj)
{
this.validate = () =>
{
let value = this.clear();
Function checkupRule
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
checkupRule(rule, data, errors)
{
if (rule.name === "string" && typeof data[rule.field] === "string") return;
if (rule.name === "number" && typeof data[rule.field] === "number") return;
- Read upRead up
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 isURI
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const isURI = value =>
{
let parts, scheme, authority, path;
if (!isString(value))
{
Function NIF
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function NIF(nif)
{
this.validate = () =>
{
let value = this.clear(nif);
Function NIF
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function NIF(nif)
{
this.validate = () =>
{
let value = this.clear(nif);
- Read upRead up
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 validate
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.validate = () =>
{
let value = this.clear();
if (value.length !== 14 || /^(\d)\1+$/.test(value)) return false;
Function isURI
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const isURI = value =>
{
let parts, scheme, authority, path;
if (!isString(value))
{
- Read upRead up
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
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return true;
Function matches
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const matches = (value, options) =>
{
if (!isString(options))
throw new TypeError(`matches(): invalid input argument. List of options must be a string. value: ${options}`);
- Read upRead up
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 isEmpty
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const isEmpty = value =>
{
if (isString(value) && !value.length)
{
return true;
- Read upRead up
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"