trentmwillis/ember-asset-loader

View on GitHub

Showing 8 of 10 total issues

Function build has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

AssetManifestGenerator.prototype.build = function() {
  var supportedTypes = this.supportedTypes;
  var generateURI = this.generateURI;
  var prepend = this.prepend;
  var filesToIgnore = this.filesToIgnore;
Severity: Minor
Found in lib/asset-manifest-generator.js - About 2 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

Function build has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AssetManifestGenerator.prototype.build = function() {
  var supportedTypes = this.supportedTypes;
  var generateURI = this.generateURI;
  var prepend = this.prepend;
  var filesToIgnore = this.filesToIgnore;
Severity: Minor
Found in lib/asset-manifest-generator.js - About 1 hr to fix

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

    export default nodeLoader(function css(uri) {
      return new RSVP.Promise((resolve, reject) => {
        if (document.querySelector(`link[href="${uri}"]`)) {
          return resolve();
        }
    Severity: Minor
    Found in addon/loaders/css.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 generateAssetManifest has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function generateAssetManifest(tree, options) {
      options = options || {};
    
      var bundlesLocation = options.bundlesLocation || 'bundles';
      var filesToIgnore = options.filesToIgnore || [];
    Severity: Minor
    Found in lib/generate-asset-manifest.js - About 1 hr to fix

      Function manifest has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var manifest = walk(inputPath).reduce(function(manifest, entry) {
          var pathParts = entry.split('/');
          var assetName = pathParts.pop();
          var bundleName = pathParts.shift();
      
      
      Severity: Minor
      Found in lib/asset-manifest-generator.js - About 1 hr to fix

        Function css has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default nodeLoader(function css(uri) {
          return new RSVP.Promise((resolve, reject) => {
            if (document.querySelector(`link[href="${uri}"]`)) {
              return resolve();
            }
        Severity: Minor
        Found in addon/loaders/css.js - About 1 hr to fix

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

            loadBundle(name, retryLoad) {
              const cachedPromise = this._getFromCache('bundle', name, retryLoad === RETRY_LOAD_SECRET);
          
              if (cachedPromise) {
                return cachedPromise;
          Severity: Minor
          Found in addon/services/asset-loader.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          function compareAndIterate(initial, current, diffHandler) {
            if (initial.length < current.length) {
              for (let i = 0; i < current.length; i++) {
                let entry = current[i];
                if (!has(initial, entry)) {
          Severity: Minor
          Found in addon-test-support/loaded-asset-state.js - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language