medialize/ally.js

View on GitHub

Showing 736 of 736 total issues

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

        setTimeout(deferred.callback(function() {
          expect(input.disabled).to.equal(true, 'element disabled upon mutation');
          expect(filteredInput.disabled).to.equal(false, 'filtered element not disabled');
        }), 50);
Severity: Major
Found in test/unit/maintain.disabled.test.js and 1 other location - About 1 hr to fix
test/unit/maintain.disabled.test.js on lines 218..221

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

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

const config = {
  name: 'table',
  out: path.resolve(TARGET, 'table.js'),
  mainConfigFile: path.resolve(SOURCE, 'table.js'),
  paths: {
Severity: Major
Found in build/web-tests/build.event-sequence.js and 1 other location - About 1 hr to fix
build/web-tests/build.focusable.js on lines 23..31

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

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

  _registerHostParent(host, parent) {
    if (!this.inHost[parent._sortingId]) {
      this.inHost[parent._sortingId] = [];
    }

Severity: Major
Found in src/query/tabsequence.sort-shadowed.js and 1 other location - About 1 hr to fix
src/query/tabsequence.sort-shadowed.js on lines 54..60

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

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

    bdd.it('should shift focus back into tabsequence', function() {
      this.timeout = timeout;
      return this.remote
        .focusById('before')
        .expectActiveElement('before', 'initial position')
Severity: Major
Found in test/functional/maintain.tab-focus.test.js and 1 other location - About 1 hr to fix
test/functional/element.disabled.test.js on lines 25..34

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

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

      bdd.it('should return {browser-specific} for <svg>', function() {
        var element = document.getElementById('svg');
        expect(isFocusableAndTabbable(element)).to.equal(supports.focusingSvgElements && supports.focusSvg);
      });
Severity: Major
Found in test/unit/is.tabbable.test.js and 1 other location - About 1 hr to fix
test/unit/is.focusable.test.js on lines 209..212

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

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

      bdd.it('should return {browser-specific} for <svg>', function() {
        var element = document.getElementById('svg');
        expect(isFocusable(element)).to.equal(supports.focusingSvgElements && supports.focusSvg);
      });
Severity: Major
Found in test/unit/is.focusable.test.js and 1 other location - About 1 hr to fix
test/unit/is.tabbable.test.js on lines 234..237

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

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 plugin has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function plugin(/* options */) {
  return function(files, metalsmith, done) {
    const indexes = {
      documentation: [],
      tutorial: [],
Severity: Minor
Found in build/metalsmith/plugins/write-algolia-index.js - About 1 hr to fix

    Function exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(md/*, options */) {
      md.core.ruler.push('container_example', function(state) {
        const tokens = state.tokens;
        let containerOpen;
        let headingContent;
    Severity: Minor
    Found in build/metalsmith/markdown/markdown-container-example.js - About 1 hr to fix

      Function exports has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(md, options) {
        if (!options || !options.pattern || !options.url) {
          throw new Error('the options "pattern" and "url" are required!');
        }
      
      
      Severity: Minor
      Found in build/metalsmith/markdown/markdown-link-code.js - About 1 hr to fix

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

              bdd.it('should return null for `<area>`s not within a `<map>`', function() {
                var area = document.getElementById('non-map-area');
                var image = imageMap.getImageOfArea(area);
                expect(image).to.equal(null);
              });
        Severity: Major
        Found in test/unit/util.image-map.test.js and 3 other locations - About 1 hr to fix
        test/unit/util.image-map.test.js on lines 58..62
        test/unit/util.image-map.test.js on lines 64..68
        test/unit/util.image-map.test.js on lines 78..82

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

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

              bdd.it('should return null for image referencing unknown map', function() {
                var image = document.getElementById('image-with-unknown-map');
                var map = imageMap.getMapOfImage(image);
                expect(map).to.equal(null);
              });
        Severity: Major
        Found in test/unit/util.image-map.test.js and 3 other locations - About 1 hr to fix
        test/unit/util.image-map.test.js on lines 58..62
        test/unit/util.image-map.test.js on lines 78..82
        test/unit/util.image-map.test.js on lines 84..88

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

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

              bdd.it('should return null for image not referencing a map', function() {
                var image = document.getElementById('image-without-map');
                var map = imageMap.getMapOfImage(image);
                expect(map).to.equal(null);
              });
        Severity: Major
        Found in test/unit/util.image-map.test.js and 3 other locations - About 1 hr to fix
        test/unit/util.image-map.test.js on lines 64..68
        test/unit/util.image-map.test.js on lines 78..82
        test/unit/util.image-map.test.js on lines 84..88

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

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

              bdd.it('should return null for `<area>`s whose parent `<map>` is not referenced by an image', function() {
                var area = document.getElementById('disconnected-map-area');
                var image = imageMap.getImageOfArea(area);
                expect(image).to.equal(null);
              });
        Severity: Major
        Found in test/unit/util.image-map.test.js and 3 other locations - About 1 hr to fix
        test/unit/util.image-map.test.js on lines 58..62
        test/unit/util.image-map.test.js on lines 64..68
        test/unit/util.image-map.test.js on lines 84..88

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

        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 generateBrowserStructure has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function generateBrowserStructure(ident, browser, browserData) {
          const element = browserData.elements[ident] || {};
          const scriptFocus = element.scriptFocus || {};
          const ally = element.ally || {};
          const jquery = element.jquery || {};
        Severity: Minor
        Found in build/data-tables/utils/aggregated-focusable-data.js - About 1 hr to fix

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

                bdd.it('should return the label\'s control element', function() {
                  var target = getFocusRedirectTarget({
                    context: document.getElementById('label'),
                  });
          
          
          Severity: Major
          Found in test/unit/get.focus-redirect-target.test.js and 1 other location - About 1 hr to fix
          test/unit/get.focus-redirect-target.test.js on lines 93..99

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

          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

                bdd.it('should return the label\'s nested control element', function() {
                  var target = getFocusRedirectTarget({
                    context: document.getElementById('label-nested'),
                  });
          
          
          Severity: Major
          Found in test/unit/get.focus-redirect-target.test.js and 1 other location - About 1 hr to fix
          test/unit/get.focus-redirect-target.test.js on lines 85..91

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

          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

                bdd.it('should return -2 for element with tabindex="-2"', function() {
                  var element = document.getElementById('tabindex--2');
                  var result = tabindexValue(element);
                  expect(result).to.equal(-2);
                });
          Severity: Major
          Found in test/unit/util.tabindex-value.test.js and 1 other location - About 1 hr to fix
          test/unit/util.tabindex-value.test.js on lines 61..65

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

          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

                bdd.it('should return -1 for element with tabindex="-1"', function() {
                  var element = document.getElementById('tabindex--1');
                  var result = tabindexValue(element);
                  expect(result).to.equal(-1);
                });
          Severity: Major
          Found in test/unit/util.tabindex-value.test.js and 1 other location - About 1 hr to fix
          test/unit/util.tabindex-value.test.js on lines 55..59

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

          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 plugin has a Cognitive Complexity of 12 (exceeds 5 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

          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 readableLabel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function readableLabel(focusable, tabbable, onlyTabbable, redirecting, focusHost) {
            return (redirecting && 'redirecting')
              || (focusable && tabbable && 'tabbable')
              || (focusable && !tabbable && 'focusable')
              || (!focusable && tabbable && 'only tabbable')
          Severity: Minor
          Found in build/data-tables/utils/aggregated-focusable-data.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

          Severity
          Category
          Status
          Source
          Language