fixjs/define.js

View on GitHub

Showing 149 of 149 total issues

File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * DefineJS v0.2.9 2015-04-16T23:09Z
 * Copyright (c) 2014 Mehran Hatami and define.js contributors.
 * Available via the MIT license.
 * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
Severity: Major
Found in examples/simple-promised-module/define.js - About 1 day to fix

    File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * DefineJS v0.2.9 2015-04-16T23:09Z
     * Copyright (c) 2014 Mehran Hatami and define.js contributors.
     * Available via the MIT license.
     * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
    Severity: Major
    Found in examples/definejs-promised-modules/define.js - About 1 day to fix

      File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * DefineJS v0.2.9 2015-04-16T23:09Z
       * Copyright (c) 2014 Mehran Hatami and define.js contributors.
       * Available via the MIT license.
       * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
      Severity: Major
      Found in examples/define-module-mapping/define.js - About 1 day to fix

        File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * DefineJS v0.2.9 2015-04-16T23:09Z
         * Copyright (c) 2014 Mehran Hatami and define.js contributors.
         * Available via the MIT license.
         * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
        Severity: Major
        Found in examples/rjs-amd-optimizer/define.js - About 1 day to fix

          File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * DefineJS v0.2.9 2015-04-16T23:09Z
           * Copyright (c) 2014 Mehran Hatami and define.js contributors.
           * Available via the MIT license.
           * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
          Severity: Major
          Found in examples/regular-amd-style/define.js - About 1 day to fix

            File define.js has 541 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * DefineJS v0.2.9 2015-04-16T23:09Z
             * Copyright (c) 2014 Mehran Hatami and define.js contributors.
             * Available via the MIT license.
             * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
            Severity: Major
            Found in define.js - About 1 day to fix

              Function 4 has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                4: [ function(require, module, exports) {
                  (function(process) {
                    var head = {
                      task: void 0,
                      next: null
              Severity: Minor
              Found in polyfills/promise-6.1.0.js - About 7 hrs 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

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

                  function installModule(moduleName, status) {
                    var callbacks, fn,
                      i, len;
              
                    if (status === 'success') {
              Severity: Major
              Found in build/old/define.js and 1 other location - About 7 hrs to fix
              build/old/define.debug.js on lines 236..262

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

              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

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

                  function installModule(moduleName, status) {
                    var callbacks, fn,
                      i, len;
              
                    if (status === 'success') {
              Severity: Major
              Found in build/old/define.debug.js and 1 other location - About 7 hrs to fix
              build/old/define.js on lines 217..243

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

              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

              File define.promise.js has 449 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               * DefineJS v0.2.31
               * Copyright (c) 2014 Mehran Hatami and define.js contributors.
               * Available via the MIT license.
               * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
              Severity: Minor
              Found in build/old/define.promise.js - About 6 hrs to fix

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

                    function fxrequire(array, fn) {
                      if (typeof fn !== 'function') {
                        console.error('Invalid input parameter to require a module');
                        return;
                      }
                Severity: Major
                Found in build/old/define.js and 1 other location - About 5 hrs to fix
                build/old/define.debug.js on lines 403..422

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

                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

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

                    function fxrequire(array, fn) {
                      if (typeof fn !== 'function') {
                        console.error('Invalid input parameter to require a module');
                        return;
                      }
                Severity: Major
                Found in build/old/define.debug.js and 1 other location - About 5 hrs to fix
                build/old/define.js on lines 384..403

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

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

                module.exports = function (grunt) {
                  'use strict';
                
                  var examples = [
                    'regular-amd-style',
                Severity: Major
                Found in Gruntfile.js - About 5 hrs to fix

                  File define.debug.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * DefineJS v0.2.31
                   * Copyright (c) 2014 Mehran Hatami and define.js contributors.
                   * Available via the MIT license.
                   * license found at http://github.com/fixjs/define.js/raw/master/LICENSE
                  Severity: Minor
                  Found in build/old/define.debug.js - About 5 hrs to fix

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

                        req.onreadystatechange = function () {
                          if (this.readyState === 4) {
                    
                            if (this.status === 200) {
                              var jsonObject;
                    examples/definejs-promised-modules/lib/promiseModules/jqueryPromise.js on lines 11..28

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

                    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

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

                        req.onreadystatechange = function () {
                          if (this.readyState === 4) {
                    
                            if (this.status === 200) {
                              var jsonObject;
                    examples/definejs-promised-modules/lib/promiseModules/qPromise.js on lines 13..30

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

                    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

                        function setUpModule(moduleName, moduleDefinition, args) {
                          var moduleData = executeFN(moduleDefinition, args),
                            setUp,
                            //we could have checked it out with (moduleData instanceof Promise)
                            //But this way we are actually being nice to nonnative promise libraries
                    Severity: Major
                    Found in build/old/define.js and 1 other location - About 5 hrs to fix
                    build/old/define.debug.js on lines 323..349

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

                    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

                        function setUpModule(moduleName, moduleDefinition, args) {
                          var moduleData = executeFN(moduleDefinition, args),
                            setUp,
                            //we could have checked it out with (moduleData instanceof Promise)
                            //But this way we are actually being nice to nonnative promise libraries
                    Severity: Major
                    Found in build/old/define.debug.js and 1 other location - About 5 hrs to fix
                    build/old/define.js on lines 304..330

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

                    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

                    File promise-6.1.0.js has 375 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    (function e(t, n, r) {
                      function s(o, u) {
                        if (!n[o]) {
                          if (!t[o]) {
                            var a = typeof require == "function" && require;
                    Severity: Minor
                    Found in polyfills/promise-6.1.0.js - About 5 hrs to fix

                      Function 2 has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                      Open

                        2: [ function(require, module, exports) {
                          "use strict";
                          var asap = require("asap");
                          module.exports = Promise;
                          function Promise(fn) {
                      Severity: Minor
                      Found in polyfills/promise-6.1.0.js - About 4 hrs 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