parpeoficial/stackerjs-utils

View on GitHub

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();
Severity: Minor
Found in src/Utils/BR/CNPJ.js - About 2 hrs 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 CPF has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

export default function CPF(cpf) 
{
    this.validate = () => 
    {
        let value = this.clear();
Severity: Minor
Found in src/Utils/BR/CPF.js - About 2 hrs 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 CPF has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function CPF(cpf) 
{
    this.validate = () => 
    {
        let value = this.clear();
Severity: Major
Found in src/Utils/BR/CPF.js - About 2 hrs to fix

    Function CNPJ has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function CNPJ(cnpj) 
    {
        this.validate = () => 
        {
            let value = this.clear();
    Severity: Minor
    Found in src/Utils/BR/CNPJ.js - About 1 hr to fix

      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;
      Severity: Minor
      Found in src/Factories/ValidatorFactory.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 isURI has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const isURI = value => 
      {
          let parts, scheme, authority, path;
          if (!isString(value)) 
          {
      Severity: Minor
      Found in src/Utils/String.js - About 1 hr to fix

        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);
        Severity: Minor
        Found in src/Utils/PT/NIF.js - About 1 hr to fix

          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);
          Severity: Minor
          Found in src/Utils/PT/NIF.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 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;
          
          
          Severity: Minor
          Found in src/Utils/BR/CNPJ.js - About 1 hr to fix

            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)) 
                {
            Severity: Minor
            Found in src/Utils/String.js - About 35 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

            Avoid too many return statements within this function.
            Open

                        return;
            Severity: Major
            Found in src/Factories/ValidatorFactory.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return false;
              Severity: Major
              Found in src/Utils/String.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return;
                Severity: Major
                Found in src/Factories/ValidatorFactory.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return true;
                  Severity: Major
                  Found in src/Utils/String.js - About 30 mins to fix

                    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}`);
                    
                    
                    Severity: Minor
                    Found in src/Utils/Other.js - About 25 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

                    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;
                    Severity: Minor
                    Found in src/Utils/Other.js - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language