medialize/ally.js

View on GitHub

Showing 736 of 736 total issues

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

export default function(context) {
  if (!supports) {
    supports = _supports();
  }

Severity: Minor
Found in src/is/valid-tabindex.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 ?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 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

        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

            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

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

                      bdd.it('should return {browser-specific} for <div tabindex="0">', function() {
                        var element = document.getElementById('tabindex-0');
                        expect(isFocusableAndTabbable(element)).to.equal(trueUnlessPlatform);
                      });
                Severity: Major
                Found in test/unit/is.tabbable.test.js and 4 other locations - About 1 hr to fix
                test/unit/is.tabbable.test.js on lines 86..89
                test/unit/is.tabbable.test.js on lines 103..106
                test/unit/is.tabbable.test.js on lines 190..193
                test/unit/is.tabbable.test.js on lines 222..225

                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 55.

                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 5 locations. Consider refactoring.
                Open

                      bdd.it('should return {browser-specific} for <a href="…">', function() {
                        var element = document.getElementById('link');
                        expect(isFocusableAndTabbable(element)).to.equal(trueUnlessPlatform);
                      });
                Severity: Major
                Found in test/unit/is.tabbable.test.js and 4 other locations - About 1 hr to fix
                test/unit/is.tabbable.test.js on lines 81..84
                test/unit/is.tabbable.test.js on lines 86..89
                test/unit/is.tabbable.test.js on lines 190..193
                test/unit/is.tabbable.test.js on lines 222..225

                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 55.

                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

                    {
                      source: sources.hits(index.documentation, { hitsPerPage: 2 }),
                      displayKey: 'title',
                      templates: {
                        suggestion: formatSuggestion,
                Severity: Major
                Found in build/metalsmith/assets/website.js and 2 other locations - About 1 hr to fix
                build/metalsmith/assets/website.js on lines 88..97
                build/metalsmith/assets/website.js on lines 98..107

                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 55.

                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 5 locations. Consider refactoring.
                Open

                      bdd.it('should return {browser-specific} for <area>', function() {
                        var element = document.getElementById('image-map-area');
                        expect(isFocusableAndTabbable(element)).to.equal(trueUnlessPlatform);
                      });
                Severity: Major
                Found in test/unit/is.tabbable.test.js and 4 other locations - About 1 hr to fix
                test/unit/is.tabbable.test.js on lines 81..84
                test/unit/is.tabbable.test.js on lines 86..89
                test/unit/is.tabbable.test.js on lines 103..106
                test/unit/is.tabbable.test.js on lines 222..225

                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 55.

                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

                    {
                      source: sources.hits(index.tutorial, { hitsPerPage: 2 }),
                      displayKey: 'title',
                      templates: {
                        suggestion: formatSuggestion,
                Severity: Major
                Found in build/metalsmith/assets/website.js and 2 other locations - About 1 hr to fix
                build/metalsmith/assets/website.js on lines 88..97
                build/metalsmith/assets/website.js on lines 108..117

                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 55.

                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 5 locations. Consider refactoring.
                Open

                      bdd.it('should return {browser-specific} for <div tabindex="1">', function() {
                        var element = document.getElementById('tabindex-1');
                        expect(isFocusableAndTabbable(element)).to.equal(trueUnlessPlatform);
                      });
                Severity: Major
                Found in test/unit/is.tabbable.test.js and 4 other locations - About 1 hr to fix
                test/unit/is.tabbable.test.js on lines 81..84
                test/unit/is.tabbable.test.js on lines 103..106
                test/unit/is.tabbable.test.js on lines 190..193
                test/unit/is.tabbable.test.js on lines 222..225

                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 55.

                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

                    {
                      source: sources.hits(index.api, { hitsPerPage: 3 }),
                      displayKey: 'title',
                      templates: {
                        suggestion: formatSuggestion,
                Severity: Major
                Found in build/metalsmith/assets/website.js and 2 other locations - About 1 hr to fix
                build/metalsmith/assets/website.js on lines 98..107
                build/metalsmith/assets/website.js on lines 108..117

                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 55.

                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 5 locations. Consider refactoring.
                Open

                      bdd.it('should return {browser-specific} for <audio controls>', function() {
                        var element = document.getElementById('audio-controls');
                        expect(isFocusableAndTabbable(element)).to.equal(trueUnlessPlatform);
                      });
                Severity: Major
                Found in test/unit/is.tabbable.test.js and 4 other locations - About 1 hr to fix
                test/unit/is.tabbable.test.js on lines 81..84
                test/unit/is.tabbable.test.js on lines 86..89
                test/unit/is.tabbable.test.js on lines 103..106
                test/unit/is.tabbable.test.js on lines 190..193

                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 55.

                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

                    data.redirect && Object.keys(data.redirect).forEach(function(mapping) {
                      this._importRedirectionNotes(mapping, data, _map);
                    }, this);
                Severity: Major
                Found in build/data-tables/utils/focusable.notes.interface.js and 1 other location - About 1 hr to fix
                build/data-tables/utils/focusable.notes.interface.js on lines 43..45

                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 55.

                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

                    data.browsers && Object.keys(data.browsers).forEach(function(browser) {
                      this._importBrowserNotes(browser, data, _map);
                    }, this);
                Severity: Major
                Found in build/data-tables/utils/focusable.notes.interface.js and 1 other location - About 1 hr to fix
                build/data-tables/utils/focusable.notes.interface.js on lines 47..49

                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 55.

                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

                    bdd.afterEach(function() {
                      handle && handle.disengage({ force: true });
                      fixture.remove();
                      fixture = null;
                    });
                Severity: Major
                Found in test/unit/when.focusable.test.js and 2 other locations - About 55 mins to fix
                test/unit/maintain.tab-focus.test.js on lines 37..41
                test/unit/when.visible-area.test.js on lines 36..40

                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 54.

                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

                    bdd.after(function() {
                      handle && handle.disengage({ force: true });
                      fixture.remove();
                      fixture = null;
                    });
                Severity: Major
                Found in test/unit/maintain.tab-focus.test.js and 2 other locations - About 55 mins to fix
                test/unit/when.focusable.test.js on lines 36..40
                test/unit/when.visible-area.test.js on lines 36..40

                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 54.

                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

                Severity
                Category
                Status
                Source
                Language