MiguelMadero/ember-cli-bundle-loader

View on GitHub

Showing 16 of 16 total issues

Function EmberAppWithPackages has 113 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function EmberAppWithPackages(defaults, options) {
  var isAddon = !!(defaults.project.pkg["ember-addon"] && defaults.project.pkg["ember-addon"].configPath),
    sharedBuildConfig = {
      // TODO: re-enable jshint once it's actually working fine, for now it just slows down the build
      // and running `ember test` it only jshints boot, but not the packages. We'll rely an npm script
Severity: Major
Found in lib/broccoli/ember-app-with-packages.js - About 4 hrs to fix

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

        let promise = new Ember.RSVP.Promise((resolve, reject)=>{
          scriptElement.one('load', ()=> Ember.run(null, resolve));
          scriptElement.one('error', (evt)=> Ember.run(null, reject, evt));
        }).catch(()=> {
          document.head.removeChild(scriptElement[0]);
    Severity: Major
    Found in addon/utils/-resource-helper.js and 1 other location - About 4 hrs to fix
    addon/utils/-resource-helper.js on lines 30..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 122.

    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

        let promise = new Ember.RSVP.Promise((resolve, reject)=>{
          linkElement.one('load', ()=> Ember.run(null, resolve));
          linkElement.one('error', (evt)=> Ember.run(null, reject, evt));
        }).catch(()=> {
          document.head.removeChild(linkElement[0]);
    Severity: Major
    Found in addon/utils/-resource-helper.js and 1 other location - About 4 hrs to fix
    addon/utils/-resource-helper.js on lines 14..20

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

    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

    module.exports = function (defaults) {
      var emberAppWithPackages = new EmberAppWithPackages(defaults, {
        sharedBuildConfig: {
          // This configuration applies to the app config as well as all the packages
        },
    Severity: Major
    Found in ember-cli-build.js and 1 other location - About 2 hrs to fix
    blueprints/ember-cli-bundle-loader/files/ember-cli-build.js on lines 4..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 90.

    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

    module.exports = function (defaults) {
      var emberAppWithPackages = new EmberAppWithPackages(defaults, {
        sharedBuildConfig: {
          // This configuration applies to the app config as well as all the packages
        },
    Severity: Major
    Found in blueprints/ember-cli-bundle-loader/files/ember-cli-build.js and 1 other location - About 2 hrs to fix
    ember-cli-build.js on lines 4..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 90.

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

    function EmberAppWithPackages(defaults, options) {
      var isAddon = !!(defaults.project.pkg["ember-addon"] && defaults.project.pkg["ember-addon"].configPath),
        sharedBuildConfig = {
          // TODO: re-enable jshint once it's actually working fine, for now it just slows down the build
          // and running `ember test` it only jshints boot, but not the packages. We'll rely an npm script
    Severity: Minor
    Found in lib/broccoli/ember-app-with-packages.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 packagesApplications has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.packagesApplications = packageNames.map(function(packageName) {
        // packages export their own js file and are intended to distribute the code-base.
        var perPackageConfig = perPackageConfigFactory(packageName);
        perPackageConfig = merge({}, perPackageConfig, {appTreesBasePath: 'packages/' + packageName});
    
    
    Severity: Minor
    Found in lib/broccoli/ember-app-with-packages.js - About 1 hr to fix

      Function _getHandlerFunction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _getHandlerFunction: function() {
          var container = getContainer(this);
          var DefaultRoute = getFactory(this, 'route:basic');
          var LazyLoaderRoute =getFactory(this, 'route:-lazy-loader');
          var lazyLoaderService = container.lookup('service:lazy-loader');
      Severity: Minor
      Found in addon/lazy-router.js - About 1 hr to fix

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

        export function loadStylesheet (url) {
          return singleInflightPromise(url, ()=>{
            if (ResourceHelper.isStylesheetLoaded(url)) {
              return resolve();
            }
        Severity: Major
        Found in addon/utils/load-assets.js and 1 other location - About 1 hr to fix
        addon/utils/load-assets.js on lines 22..29

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

        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

        export function loadScript (url) {
          return singleInflightPromise(url, ()=> {
            if (ResourceHelper.isJavascriptLoaded(url)) {
              return resolve();
            }
        Severity: Major
        Found in addon/utils/load-assets.js and 1 other location - About 1 hr to fix
        addon/utils/load-assets.js on lines 31..38

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

        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

            assert.deepEqual(newConfig, [{
              name: 'my-package',
              routeNames: ['^irrelevant'],
              packages: ['my-package'],
              urls: ['assets/my-package.js', 'assets/my-package.css'],
        Severity: Minor
        Found in tests-node/test.js and 1 other location - About 55 mins to fix
        tests-node/test.js on lines 75..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 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

            assert.deepEqual(newConfig, [{
              name: 'my-package',
              packages: ['my-package'],
              routeNames: ['^irrelevant'],
              urls: ['/static/client-app/assets/my-package.js', '/static/client-app/assets/my-package.css'],
        Severity: Minor
        Found in tests-node/test.js and 1 other location - About 55 mins to fix
        tests-node/test.js on lines 57..64

        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

            assert.deepEqual(newConfig, [{
              name: 'my-package',
              packages: ['my-package'],
              urls: ['irrelevant.js'],
              routeNames: ['^x'],
        Severity: Major
        Found in tests-node/test.js and 2 other locations - About 55 mins to fix
        tests-node/test.js on lines 93..100
        tests-node/test.js on lines 129..136

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

        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

            assert.deepEqual(newConfig, [{
              name: 'my-package',
              packages: ['my-package'],
              routeNames: ['^my-package'],
              urls: ['irrelevant.js'],
        Severity: Major
        Found in tests-node/test.js and 2 other locations - About 55 mins to fix
        tests-node/test.js on lines 111..118
        tests-node/test.js on lines 129..136

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

        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

            assert.deepEqual(newConfig, [{
              name: 'my-package',
              packages: ['my-package'],
              dependsOn: ['another-package'],
              routeNames: ['^my-package'],
        Severity: Major
        Found in tests-node/test.js and 2 other locations - About 55 mins to fix
        tests-node/test.js on lines 93..100
        tests-node/test.js on lines 111..118

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

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

        export default function loadAssets(urls = []) {
          urls = urls || [];
          const promises = urls.map(url=>
            url.match(/\.js$/) ?
              loadScript(url) :
        Severity: Minor
        Found in addon/utils/load-assets.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