ruslansagitov/loud

View on GitHub

Showing 32 of 42 total issues

File a11y-node.js has 822 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014-2024 Ruslan Sagitov
 *
Severity: Major
Found in lib/a11y-node.js - About 1 day to fix

    File role-from-tag.js has 371 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * The MIT License (MIT)
     *
     * Copyright (c) 2014-2024 Ruslan Sagitov
     *
    Severity: Minor
    Found in lib/role-from-tag.js - About 4 hrs to fix

      A11yNode has 37 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class A11yNode {
          constructor(node) {
              this.node = node;
      
              this.childs = [];
      Severity: Minor
      Found in lib/a11y-node.js - About 4 hrs to fix

        Function isDescendantsValid has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
        Open

            isDescendantsValid(limits) {
                let node = this.firstChild,
                    nodeCount = 0,
                    role, lim;
                for (; node; node = node.nextSibling) {
        Severity: Minor
        Found in lib/a11y-node.js - About 4 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 exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(config) {
            let browsers,
                reporters = ['dots'];
        
            if (process.env.KARMA_BROWSERS) {
        Severity: Major
        Found in karma.conf.js - About 2 hrs to fix

          Function setRole has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          function setRole(node) {
              let getRole = TAG_TO_ROLE[node.tag] || '',
                  roleData, role;
          
              roleData = isFunction(getRole) ? getRole.call(this, node) : getRole;
          Severity: Minor
          Found in lib/role-from-tag.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 isHidden has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              isHidden(inst) {
                  let node = this.node;
          
                  if (this.nodeType !== 1) {
                      return false;
          Severity: Minor
          Found in lib/a11y-node.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 ownedByValidRolesFor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              ownedByValidRolesFor(role) {
                  let context = ROLE_CONTEXT[role];
                  if (!context) {
                      return true;
                  }
          Severity: Minor
          Found in lib/a11y-node.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 isNodeNonEmpty has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              isNodeNonEmpty(node) {
                  node = node.firstChild;
                  for (; node; node = node.nextSibling) {
                      if (node.nodeType === 1) {
                          if (node.hidden) {
          Severity: Minor
          Found in lib/a11y-node.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 pushStates has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          function pushStates(result, node) {
              if (typeof node.checked !== 'undefined') {
                  result.push(node.checked === 'mixed' ? 'mixed' :
                      node.checked ? 'checked' : 'not checked');
              }
          Severity: Minor
          Found in lib/words-from-attributes.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 exports has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(node) {
              let that = this,
                  result = [],
                  ids;
          
          
          Severity: Minor
          Found in lib/words-from-attributes.js - About 1 hr to fix

            Function setLocalAttrs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function setLocalAttrs(node) {
                let role = node.role,
                    attrs = ROLE_LOCAL_ATTRS[role] || [];
            
                for (let attr of attrs) {
            Severity: Minor
            Found in lib/role-from-tag.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 range has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function range(roleName) {
                return function(node) {
                    let role = node.role,
                        valuetext = node.valuetext,
                        valuenow = node.valuenow,
            Severity: Minor
            Found in lib/words-from-role.js - About 1 hr to fix

              Function getTextContentFromDirectChild has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  getTextContentFromDirectChild(childName) {
                      let node = this.firstChild,
                          iter;
                      for (; node; node = node.nextSibling) {
                          if (node.nodeType !== 1) {
              Severity: Minor
              Found in lib/a11y-node.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 isHidden has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  isHidden(inst) {
                      let node = this.node;
              
                      if (this.nodeType !== 1) {
                          return false;
              Severity: Minor
              Found in lib/a11y-node.js - About 1 hr to fix

                Function isDescendantsValid has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    isDescendantsValid(limits) {
                        let node = this.firstChild,
                            nodeCount = 0,
                            role, lim;
                        for (; node; node = node.nextSibling) {
                Severity: Minor
                Found in lib/a11y-node.js - About 1 hr to fix

                  Function fixRole has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function fixRole(node) {
                      let role = node.role;
                      if (role && role !== 'presentation') {
                          if (!node.ownsValidRolesFor(role)) {
                              this.warn(`Element with role "${role
                  Severity: Minor
                  Found in lib/role-from-tag.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 pushProperties has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function pushProperties(result, node) {
                      if (node.required) {
                          result.push('required');
                      }
                  
                  
                  Severity: Minor
                  Found in lib/words-from-attributes.js - About 1 hr to fix

                    Function setRole has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function setRole(node) {
                        let getRole = TAG_TO_ROLE[node.tag] || '',
                            roleData, role;
                    
                        roleData = isFunction(getRole) ? getRole.call(this, node) : getRole;
                    Severity: Minor
                    Found in lib/role-from-tag.js - About 1 hr to fix

                      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
                        Severity
                        Category
                        Status
                        Source
                        Language