medialize/ally.js

View on GitHub

Showing 154 of 736 total issues

Function ?alt+?shift+tab has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    '?alt+?shift+tab': function(event) {
      // we're completely taking over the Tab key handling
      event.preventDefault();

      const sequence = queryTabsequence({
Severity: Minor
Found in src/maintain/tab-focus.js - About 1 hr to fix

    Function createKeyEvent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function createKeyEvent(type, options) {
        // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/KeyboardEvent
        if (typeof KeyboardEvent === 'function') {
          options.bubbles = true;
          return new KeyboardEvent(type, options);
    Severity: Minor
    Found in test/helper/dispatch-event.js - About 1 hr to fix

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

        const handleBeforeFocusEvent = function(event) {
          // find the element that would receive focus
          const target = getFocusTarget({
            context: event.target,
            except: {
      Severity: Minor
      Found in src/fix/pointer-focus-children.js - About 1 hr to fix

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

        function transform($, file, fileName, options) {
          const absolute = path.join(options.resolve, fileName);
          if (options.canonical) {
            const canonical = options.canonical + fileName;
            const $canonical = $('<link rel="canonical" href="">').attr('href', canonical);
        Severity: Minor
        Found in build/metalsmith/plugins/absolute-url.js - About 1 hr to fix

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

          module.exports = function plugin(/* options */) {
            return function(files, metalsmith, done) {
              setImmediate(done);
          
              Object.keys(files).forEach(function(key) {
          Severity: Minor
          Found in build/metalsmith/plugins/prepare.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

              if (event.type === focusEventName || event.type === 'shadow-focus') {
                const interactionType = interactionTypeHandler.get();
                source = lock
                  || interactionType.pointer && 'pointer'
                  || interactionType.key && 'key'
            Severity: Major
            Found in src/style/focus-source.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                if (platform.is.WEBKIT && platform.is.IOS) {
                  // iOS only considers a hand full of elements tabbable (keyboard focusable)
                  // this holds true even with external keyboards
                  let potentiallyTabbable = (nodeName === 'input' && element.type === 'text' || element.type === 'password')
                    || nodeName === 'select'
              Severity: Major
              Found in src/is/tabbable.js - About 1 hr to fix

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

                function setElementDisabled(element, disabledState) {
                  setAriaDisabled(element, disabledState);
                  disableTabindex(element, disabledState);
                  disableScriptFocus(element, disabledState);
                  disablePointerEvents(element, disabledState);
                Severity: Minor
                Found in src/element/disabled.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 focus has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                function focus(element) {
                  if (element.focus) {
                    element.focus();
                    return isActiveElement(element) ? element : null;
                  }
                Severity: Minor
                Found in src/element/focus.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

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

                function validateUrl(index, uri) {
                  if (uri.authority()) {
                    // fully qualified, possibly external URL
                    return null;
                  }
                Severity: Minor
                Found in build/metalsmith/plugins/link-checker.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

                Consider simplifying this complex logical expression.
                Open

                  if (isSvgElement) {
                    return validTabindex || supports.focusSvg || supports.focusSvgInIframe
                      // Internet Explorer understands the focusable attribute introduced in SVG Tiny 1.2
                      || Boolean(supports.focusSvgFocusableAttribute && focusableAttribute && focusableAttribute === 'true');
                  }
                Severity: Major
                Found in src/is/focus-relevant.js - About 40 mins to fix

                  Function readableLabel has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function readableLabel(focusable, tabbable, onlyTabbable, redirecting, focusHost) {
                  Severity: Minor
                  Found in build/data-tables/utils/aggregated-focusable-data.js - About 35 mins to fix

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

                    export default function({element, attribute, temporaryValue, saveValue}) {
                      const temporaryAttribute = 'data-cached-' + attribute;
                    
                      if (temporaryValue !== undefined) {
                        const _value = saveValue || element.getAttribute(attribute);
                    Severity: Minor
                    Found in src/util/toggle-attribute-value.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 addPlatform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function addPlatform(platform, key) {
                      // only to be used for grouping desktop and mobile browsers separately
                      let mobile = false;
                      // "Windows" needs some aliasing, possibly required for other platforms, too
                      const platformFamily = (platform.os.family === 'Windows NT' && 'Windows')
                    Severity: Minor
                    Found in build/data-tables/utils/platforms.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 default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function(elements) {
                      // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement.tabIndex
                      // elements with tabIndex "0" (including tabbableElements without tabIndex) should be navigated in the order they appear.
                      // elements with a positive tabIndex:
                      //   Elements that have identical tabIndexes should be navigated in the order they appear.
                    Severity: Minor
                    Found in src/query/tabsequence.sort-tabindex.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 default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function({
                      context,
                      sequence,
                      strategy,
                      ignoreAutofocus,
                    Severity: Minor
                    Found in src/query/first-tabbable.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 default has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default function() {
                      if (!supports) {
                        supports = _supports();
                      }
                    
                    
                    Severity: Minor
                    Found in src/selector/focusable.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 src/is/focus-relevant.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return true;
                      Severity: Major
                      Found in src/is/focus-relevant.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return true;
                        Severity: Major
                        Found in src/is/focus-relevant.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language