medialize/ally.js

View on GitHub

Showing 736 of 736 total issues

Avoid too many return statements within this function.
Open

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

    Avoid too many return statements within this function.
    Open

        return 0;
    Severity: Major
    Found in build/metalsmith/plugins/collection.manual-sort.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

        return _window.document.activeElement;
      Severity: Major
      Found in src/element/blur.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 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 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return focusableAttribute && focusableAttribute === 'false';
            Severity: Major
            Found in src/is/focusable.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return element.hasAttribute('focusable') || hasTabbableTabindex;
              Severity: Major
              Found in src/is/tabbable.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                      return element.hasAttribute('focusable');
                Severity: Major
                Found in src/is/tabbable.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return hasTabbableTabindexOrNone;
                  Severity: Major
                  Found in src/is/tabbable.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return -1;
                    Severity: Major
                    Found in build/metalsmith/plugins/collection.manual-sort.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return focusableAttribute === '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 0;
                          Severity: Major
                          Found in build/metalsmith/plugins/collection.manual-sort.js - About 30 mins to fix

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                            export default {
                              element: 'div',
                              mutate: function(element) {
                                element.setAttribute('style', 'width: 100px; height: 50px; overflow: auto;');
                                element.innerHTML = '<div style="width: 500px; height: 40px;">scrollable content</div>';
                            Severity: Minor
                            Found in src/supports/focus-scroll-container.js and 2 other locations - About 30 mins to fix
                            src/supports/focus-flexbox-container.js on lines 3..9
                            src/supports/focus-scroll-container-without-overflow.js on lines 3..9

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 45.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                            export default {
                              element: 'div',
                              mutate: function(element) {
                                element.setAttribute('style', 'width: 100px; height: 50px;');
                                element.innerHTML = '<div style="width: 500px; height: 40px;">scrollable content</div>';
                            Severity: Minor
                            Found in src/supports/focus-scroll-container-without-overflow.js and 2 other locations - About 30 mins to fix
                            src/supports/focus-flexbox-container.js on lines 3..9
                            src/supports/focus-scroll-container.js on lines 3..9

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 45.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 3 locations. Consider refactoring.
                            Open

                            export default {
                              element: 'span',
                              mutate: function(element) {
                                element.setAttribute('style', 'display: -webkit-flex; display: -ms-flexbox; display: flex;');
                                element.innerHTML = '<span style="display: block;">hello</span>';
                            Severity: Minor
                            Found in src/supports/focus-flexbox-container.js and 2 other locations - About 30 mins to fix
                            src/supports/focus-scroll-container-without-overflow.js on lines 3..9
                            src/supports/focus-scroll-container.js on lines 3..9

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 45.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                              validate: function(element, focusTarget, _document) {
                                if (platform.is.GECKO) {
                                  // fixes https://github.com/medialize/ally.js/issues/35
                                  // Firefox loads the DataURI asynchronously, causing a false-negative
                                  return true;
                            Severity: Minor
                            Found in src/supports/focus-area-without-href.js and 1 other location - About 30 mins to fix
                            src/supports/focus-object-svg.js on lines 16..24

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 45.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

                            Similar blocks of code found in 2 locations. Consider refactoring.
                            Open

                              validate: function(element, focusTarget, _document) {
                                if (platform.is.GECKO) {
                                  // Firefox seems to be handling the object creation asynchronously and thereby produces a false negative test result.
                                  // Because we know Firefox is able to focus object elements referencing SVGs, we simply cheat by sniffing the user agent string
                                  return true;
                            Severity: Minor
                            Found in src/supports/focus-object-svg.js and 1 other location - About 30 mins to fix
                            src/supports/focus-area-without-href.js on lines 15..23

                            Duplicated Code

                            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                            Tuning

                            This issue has a mass of 45.

                            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                            Refactorings

                            Further Reading

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

                            export function getParentComparator({parent, element, includeSelf} = {}) {
                              if (parent) {
                                return function isChildOf(node) {
                                  return Boolean(
                                    includeSelf && node === parent
                            Severity: Minor
                            Found in src/util/compare-position.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 default has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export default function({
                              context,
                              includeContext,
                              includeOnlyTabbable,
                              strategy,
                            Severity: Minor
                            Found in src/query/tabsequence.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