dsathyakumar/a11y-auditor

View on GitHub

Showing 79 of 129 total issues

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

_preProcessRulesConfig = function _preProcessRulesConfig() {
    var _obj, _ct, _rand;
    //> the config is a 'selector' -> ['array of rules to be skipped']
    for (var currentSelector in _rulesConfig) {
        if (_rulesConfig.hasOwnProperty(currentSelector)) {
Severity: Minor
Found in lib/audit/auditInitializer.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 _ruleExector has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function _ruleExector() {
    var _severityEnum = enums.severityEnum,
        _mainElem = $('main'),
        _mainRole = $("[role='main']"),
        _mainID = _mainElem.attr('id') || _mainRole.attr('id'),
Severity: Minor
Found in lib/rulesImpl/AX_27.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

                if (typeof elem.onclick === 'function' || typeof elem.click === 'function' || typeof elem.ondblclick === 'function' || typeof elem.dblclick === 'function' || this.getjQueryDataEvents(elem) || elem.getEventListener('click') || elem.getEventListener('dblclick')) {
                    _hasClicks = true;
                }
    Severity: Major
    Found in lib/utils/accessibilityUtils.js - About 1 hr to fix

      Function _ruleExector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function _ruleExector(elem) {
      
          var _severityEnum = enums.severityEnum;
          if ((elem.tagName === 'INPUT' || elem.tagName === 'BUTTON' && $(elem).attr('type') === 'submit') || (elem.tagName === 'BUTTON' && $(elem).attr('type') === undefined)) {
              //first check if it has an TARGET attribute
      Severity: Minor
      Found in lib/rulesImpl/AX_38.js - About 55 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 _ruleExector has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function _ruleExector(elem) {
          var _severityEnum = enums.severityEnum,
              _tagName, _txt;
      
          if (elem.hasAttribute('role') && elem.getAttribute('role') === 'main') {
      Severity: Minor
      Found in lib/rulesImpl/AX_25.js - About 55 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 validator has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          validator: function (selector) {
      
              var _validationObj = {isValid: false, selector: selector, errMsg: ''};
      
              //if selector is null / empty or if its undefined
      Severity: Minor
      Found in lib/audit/auditRunnerHelper.js - About 55 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 (list[type].hasOwnProperty(listElem)) {
                                    //> push all the listeners into the result []
                                    result.push({
                                        type: type,
                                        listener: list[type][listElem],
      Severity: Major
      Found in lib/utils/hasEvent.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                  for (var id in list[_type]) {
                                      //> hasOwnProperty check is to satisfy jshint
                                      if (list[_type].hasOwnProperty(id)) {
                                          //> push all the listener into the result []
                                          result.push({
        Severity: Major
        Found in lib/utils/hasEvent.js - About 45 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if (e && this.elementIsAriaWidget(c)) {
                      e = c.getAttribute('role');
                      'textbox' == e && c.textContent && 0 < c.textContent.length && (b.controlValue = {
                          text: c.textContent
                      });
          Severity: Major
          Found in lib/axs/axsUtils.js - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if (
                    document.hidden ||
                    _this.offsetWidth === 0 ||
                    _this.offsetHeight === 0 ||
                    _this.style.visibility === 'hidden' ||
            Severity: Major
            Found in lib/utils/elemVisibilityChecker.js - About 40 mins to fix

              Consider simplifying this complex logical expression.
              Open

                      if (this.matchSelector(a,
                              'input:not([type="hidden"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), video:not([disabled])') &&
                          !d) {
                          if (a.hasAttribute('id')) {
                              d = document.querySelectorAll('label[for="' + a.id + '"]');
              Severity: Major
              Found in lib/axs/axsUtils.js - About 40 mins to fix

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

                function _ruleExector() {
                    var _severityEnum = enums.severityEnum,
                        _mainElem = $('main'),
                        _mainRole = $("[role='main']"),
                        _mainID = _mainElem.attr('id') || _mainRole.attr('id'),
                Severity: Minor
                Found in lib/rulesImpl/AX_27.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 _addAllPropertiesToSet has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function _addAllPropertiesToSet(a, b, c) {
                    var d = a[b];
                    if (d) {
                        for (var e = 0; e < d.length; e++) {
                            c[d[e]] = !0;
                Severity: Minor
                Found in lib/axs/axsUtils.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 getRoles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    getRoles: function(a, b) {
                        if (!a || a.nodeType !== Node.ELEMENT_NODE || !a.hasAttribute('role') && !b) {
                            return null;
                        }
                        var c = a.getAttribute('role');
                Severity: Minor
                Found in lib/axs/axsUtils.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 _ruleExector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function _ruleExector(elem) {
                
                    var _severityEnum = enums.severityEnum;
                    if (elem.tagName === 'A' && ($(elem).attr('target') === 'blank' || $(elem).attr('target') === '_blank')) {
                        //first check if it has an TARGET attribute
                Severity: Minor
                Found in lib/rulesImpl/AX_37.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 _ruleExector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function _ruleExector(elem) {
                    var _severityEnum = enums.severityEnum,
                        _id = $(elem).attr('id'),
                        _labelObj;
                
                
                Severity: Minor
                Found in lib/rulesImpl/AX_19.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 composedParentNode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    composedParentNode: function(a) {
                        if (!a) {
                            return null;
                        }
                        if (a.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
                Severity: Minor
                Found in lib/axs/axsUtils.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 _ruleExector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function _ruleExector() {
                
                    var _severityEnum = enums.severityEnum,
                        _title = $('title');
                
                
                Severity: Minor
                Found in lib/rulesImpl/AX_07.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 _ruleExector has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                function _ruleExector(elem) {
                    var _severityEnum = enums.severityEnum,
                        _th;
                
                    if (elem.hasAttribute('headers') && !_.isEmpty(elem.getAttribute('headers'))) {
                Severity: Minor
                Found in lib/rulesImpl/AX_35.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 {
                                TYPE: _severityEnum.WARN,
                                RESULT: true,
                                MSG: 'Warning! This element has an ownerDocument that doesnt match with the window object. This may be part of an iframe or an XML response partial or a detached DOM fragment. The results may not be accurate!'
                            };
                Severity: Major
                Found in lib/rulesImpl/AX_36.js - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language