ruslansagitov/loud

View on GitHub

Showing 32 of 42 total issues

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

exports.flatten = function flatten(array) {
    let i = -1,
        length = array.length,
        res = [];

Severity: Minor
Found in lib/util.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

Avoid deeply nested control flow statements.
Open

                        if (!node.isDescendantsValid(lim)) {
                            return false;
                        }
Severity: Major
Found in lib/a11y-node.js - About 45 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if (this.hasAttribute('hidden') ||
                this.getAttribute('aria-hidden') === 'true' ||
                this.tag === 'input' &&
                this.getAttribute('type') === 'hidden' ||
                node.style.visibility === 'hidden' ||
    Severity: Major
    Found in lib/a11y-node.js - About 40 mins to fix

      Function isInputInsideLabel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          isInputInsideLabel() {
              let id = this.getAttribute('id');
              if (id && this.tag === 'input') {
                  let node = this.parentNode;
                  for (; node; node = node.parentNode) {
      Severity: Minor
      Found in lib/a11y-node.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

      Function say has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          say(node) {
              if (!node || !node.length || node.nodeType === 3) {
                  node = [node];
              }
      
      
      Severity: Minor
      Found in lib/loud.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

      Function pushProperties has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      function pushProperties(result, node) {
          if (node.required) {
              result.push('required');
          }
      
      
      Severity: Minor
      Found in lib/words-from-attributes.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 true;
      Severity: Major
      Found in lib/a11y-node.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return false;
        Severity: Major
        Found in lib/a11y-node.js - About 30 mins to fix

          Function exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          module.exports = function(node) {
              let that = this,
                  result = [],
                  ids;
          
          
          Severity: Minor
          Found in lib/words-from-attributes.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 setDefaults has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function setDefaults(node) {
              let role = node.role,
                  data = DEFAULT_FOR[role];
          
              if (data) {
          Severity: Minor
          Found in lib/role-from-tag.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 pushActiveDescendant has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function pushActiveDescendant(result, node) {
              if (node.activedescendant) {
                  let elem = this.getElementById(node.activedescendant);
                  if (elem) {
                      let name = this.getAccessibleName(elem);
          Severity: Minor
          Found in lib/words-from-attributes.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 pushDescribedBy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function pushDescribedBy(result, node) {
              if (node.describedby) {
                  let that = this;
                  let desc = node.describedby
                      .split(/\s+/)
          Severity: Minor
          Found in lib/words-from-attributes.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