dolox/fallback

View on GitHub

Showing 25 of 25 total issues

Function getElementsByClassName has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

  document.getElementsByClassName = function(search) {
    var d = document, elements, pattern, i, results = [];
    if (d.querySelectorAll) { // IE8
      return d.querySelectorAll("." + search);
    }
Severity: Minor
Found in examples/js/getElementsByClassName.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

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

            req(function(badUrls) {
                $('body').append('<div class="alert-success">`badUrls` Loaded Successfully</div>', badUrls);
            }, function(errors) {
                $('body').append('<div class="alert-danger">`badUrls` Failed To Load<br /><pre>' + JSON.stringify(errors) + '</pre></div>');
            });
Severity: Major
Found in examples/error-handling/main.js and 3 other locations - About 1 hr to fix
examples/error-handling/main.js on lines 24..28
examples/error-handling/main.js on lines 30..34
examples/error-handling/main.js on lines 46..50

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

            req(function(badAnonymous) {
                $('body').append('<div class="alert-success">`badAnonymous` Loaded Successfully</div>', badAnonymous);
            }, function(errors) {
                $('body').append('<div class="alert-danger">`badAnonymous` Failed To Load<br /><pre>' + JSON.stringify(errors) + '</pre></div>');
            });
Severity: Major
Found in examples/error-handling/main.js and 3 other locations - About 1 hr to fix
examples/error-handling/main.js on lines 24..28
examples/error-handling/main.js on lines 36..40
examples/error-handling/main.js on lines 46..50

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

            req(function(emptyConfig) {
                $('body').append('<div class="alert-success">`emptyConfig` Loaded Successfully</div>', emptyConfig);
            }, function(errors) {
                $('body').append('<div class="alert-danger">`emptyConfig` Failed To Load<br /><pre>' + JSON.stringify(errors) + '</pre></div>');
            });
Severity: Major
Found in examples/error-handling/main.js and 3 other locations - About 1 hr to fix
examples/error-handling/main.js on lines 30..34
examples/error-handling/main.js on lines 36..40
examples/error-handling/main.js on lines 46..50

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

            req(function(brokenDefine) {
                $('body').append('<div class="alert-success">`brokenDefine` Loaded Successfully</div>', brokenDefine);
            }, function(errors) {
                $('body').append('<div class="alert-danger">`brokenDefine` Failed To Load<br /><pre>' + JSON.stringify(errors) + '</pre></div>');
            });
Severity: Major
Found in examples/error-handling/main.js and 3 other locations - About 1 hr to fix
examples/error-handling/main.js on lines 24..28
examples/error-handling/main.js on lines 30..34
examples/error-handling/main.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 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 3 locations. Consider refactoring.
Open

            angularBootstrap: {
                deps: 'angular',

                check: function() {
                    try {
Severity: Major
Found in examples/angular/main.js and 2 other locations - About 1 hr to fix
examples/angular/main.js on lines 24..36
examples/angular/main.js on lines 38..50

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

            angularRoute: {
                deps: 'angular',

                check: function() {
                    try {
Severity: Major
Found in examples/angular/main.js and 2 other locations - About 1 hr to fix
examples/angular/main.js on lines 10..22
examples/angular/main.js on lines 38..50

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

            angularTouch: {
                deps: 'angular',

                check: function() {
                    try {
Severity: Major
Found in examples/angular/main.js and 2 other locations - About 1 hr to fix
examples/angular/main.js on lines 10..22
examples/angular/main.js on lines 24..36

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

stylesheet.check.exports = function(exports) {
    // If our `exports` parameter is not an `Array`, cast it to one.
    if (!me.isaArray(exports)) {
        exports = [exports];
    }
Severity: Minor
Found in src/loader/stylesheet.js - About 1 hr to fix

Function anonymous has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

define.anonymous = function(moduleName) {
    // If we don't have a anonymous module waiting to be defined, then halt the function. We should at the very least have
    // either a `factory` or reference to the last defined module (which in this case would be our anonymous module
    // without a name).
    if (!define.anonymous.pending && !define.module.last) {
Severity: Minor
Found in src/define.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

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

    req(function(css$bootstrap, fastclick, jQuery) {
        jQuery('.container').append('<h1 class="text-center">Stats</h1>');
        jQuery('.container').append('<pre id="stats">' + fallback.stats() + '</pre>');
    });
Severity: Major
Found in examples/amd-enforced/main.js and 2 other locations - About 1 hr to fix
examples/debugging/main.js on lines 53..56
examples/getting-started/main.js on lines 69..72

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

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

    req(function(css$bootstrap, jQueryUI, jQuery) {
        jQuery('.container').append('<h1 class="text-center">Stats</h1>');
        jQuery('.container').append('<pre id="stats">' + fallback.stats() + '</pre>');
    });
Severity: Major
Found in examples/debugging/main.js and 2 other locations - About 1 hr to fix
examples/amd-enforced/main.js on lines 47..50
examples/getting-started/main.js on lines 69..72

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

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

    req(function(css$bootstrap, jQueryUI, jQuery) {
        jQuery('.container').append('<h1 class="text-center">Stats</h1>');
        jQuery('.container').append('<pre id="stats">' + fallback.stats() + '</pre>');
    });
Severity: Major
Found in examples/getting-started/main.js and 2 other locations - About 1 hr to fix
examples/amd-enforced/main.js on lines 47..50
examples/debugging/main.js on lines 53..56

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

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

me.tasks.test = function() {
    me.grunt.registerTask('test', function() {
        var done = this.async();
        var series = [];
        var success = true;
Severity: Minor
Found in Gruntfile.js - About 1 hr to fix

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

javascript.check = function(module, postLoadCheck) {
    // See if the module itself has been flagged as loaded.
    if (module.loader.loaded === true || module.amd === true && postLoadCheck === true) {
        return true;
    }
Severity: Minor
Found in src/loader/javascript.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 attributes has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

javascript.attributes = function(attribute) {
    // The `Array` to store our `attribute` values.
    var values = [];

    // If the `attribute` is not a string, halt the `Function`.
Severity: Minor
Found in src/loader/javascript.js - About 1 hr to fix

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

define.args.router[0] = function(args, payload) {
    // Throw an error to the end user.
    me.log(1, 'define', 'args', 'No arguments were passed into `define`! Halting!', args);

    // Return our factored payload.
Severity: Minor
Found in src/define.js and 1 other location - About 55 mins to fix
src/require.js on lines 150..156

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

require.args.router[0] = function(args, payload) {
    // Throw an error to the end user.
    me.log(1, 'require', 'args', 'No arguments were passed into `require`! Halting!', args);

    // Return our factored payload.
Severity: Minor
Found in src/require.js and 1 other location - About 55 mins to fix
src/define.js on lines 188..194

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

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

me.isType = function(variable, type) {
    // Special check for `null` for legacy browsers. @ie
    if (type === 'Object' && variable === null) {
        return false;
    }
Severity: Minor
Found in src/core.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 log has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

var log = function() {
    // Make sure that both debugging is enable and what `global.console` exists.
    if (!me.config.settings.debug || !global.console) {
        return false;
    }
Severity: Minor
Found in src/log.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

Severity
Category
Status
Source
Language