ember-cli/ember-twiddle

View on GitHub

Showing 52 of 52 total issues

File ember-cli.js has 557 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { readOnly } from '@ember/object/computed';
import Service, { inject as service } from '@ember/service';
import RSVP from 'rsvp';
import { run } from '@ember/runloop';
import $ from 'jquery';
Severity: Major
Found in app/services/ember-cli.js - About 1 day to fix

    Function processEmberShims has 212 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function processEmberShims() {
          var shims = {
            'ember': {
              'default': Ember
            },
    Severity: Major
    Found in vendor/app-shims.js - About 1 day to fix

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

      module.exports = function(defaults) {
      
        const EmberApp = require('ember-cli/lib/broccoli/ember-app');
        const funnel = require('broccoli-funnel');
        const mergeTrees = require('broccoli-merge-trees');
      Severity: Major
      Found in ember-cli-build.js - About 5 hrs to fix

        Function default has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function(babel, _options) {
          var options = _options || {};
        
          function htmlbarsInlineCompilerPlugin(babel) {
            let t = babel.types;
        Severity: Minor
        Found in app/plugins/hbs-plugin.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

        Function handleColocatedComponents has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          handleColocatedComponents(gist) {
            let colocatedTemplatesRegex = /^components\/([^/]+\/)*[^/]+\.hbs$/
        
            let files = gist.get('files').toArray();
            let filePaths = files.map(file => file.get('filePath'));
        Severity: Major
        Found in app/services/ember-cli.js - About 4 hrs to fix

          Function resolveAddonsTask has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

            resolveAddonsTask: task(function *(addons, dependencies, emberVersion) {
              let done = false;
              while (!done) {
                let addonPromises = {};
                let addonNames = Object.keys(addons);
          Severity: Minor
          Found in app/services/dependency-resolver.js - About 3 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

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

            if (deployTarget === 'staging') {
              ENV['s3'] = {
                accessKeyId: process.env['AWS_ACCESS_KEY_ID'],
                secretAccessKey: process.env['AWS_ACCESS_KEY_SECRET'],
                bucket: "canary-assets.ember-twiddle.com",
          Severity: Major
          Found in config/deploy.js and 1 other location - About 3 hrs to fix
          config/deploy.js on lines 28..42

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

          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

            if (deployTarget === 'production' && process.env.TORII_PROVIDER === 'github-oauth2') {
              ENV['s3'] = {
                accessKeyId: process.env['AWS_ACCESS_KEY_ID'],
                secretAccessKey: process.env['AWS_ACCESS_KEY_SECRET'],
                bucket: "assets.ember-twiddle.com",
          Severity: Major
          Found in config/deploy.js and 1 other location - About 3 hrs to fix
          config/deploy.js on lines 11..25

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

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

            buildDependencies(twiddleJSON) {
              let deps = twiddleJSON.dependencies;
              let depCssLinkTags = '';
              let depScriptTags = '';
              let testStuff = '';
          Severity: Major
          Found in app/services/ember-cli.js - About 3 hrs to fix

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

              language() {
                if (!this.filename) {
                  return "";
                }
                let extension = this.filename.substring(this.filename.lastIndexOf("."), this.filename.length);
            Severity: Major
            Found in mirage/factories/gist-file.js and 1 other location - About 3 hrs to fix
            mirage/factories/gist-file.js on lines 7..22

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

            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

              type() {
                if (!this.filename) {
                  return "";
                }
                let extension = this.filename.substring(this.filename.lastIndexOf("."), this.filename.length);
            Severity: Major
            Found in mirage/factories/gist-file.js and 1 other location - About 3 hrs to fix
            mirage/factories/gist-file.js on lines 23..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 96.

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

            module.exports = function(environment) {
              let deployTarget = process.env.DEPLOY_TARGET;
              let rootURL = process.env.TWIDDLE_ROOT_URL || '/';
              let host = process.env.GH_API_HOST || 'https://api.github.com';
              let toriiGHEBaseURL = process.env.TORII_GHE_OAUTH || null;
            Severity: Major
            Found in config/environment.js - About 2 hrs to fix

              `` has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

                actions: {
                  contentsChanged() {
                    this.set('unsaved', true);
                    this.rebuildApp.perform();
                  },
              Severity: Minor
              Found in app/components/main-gist.js - About 2 hrs to fix

                Function drags has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  $.fn.drags = function(opt) {
                
                    if (opt === "destroy") {
                      destroyFn(this);
                      return;
                Severity: Major
                Found in vendor/drags.js - About 2 hrs to fix

                  Function buildQUnitTree has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function buildQUnitTree(app) {
                    const funnel = require('broccoli-funnel');
                    const concat = require('broccoli-concat');
                    const replace = require('broccoli-string-replace');
                    const mergeTrees = require('broccoli-merge-trees');
                  Severity: Major
                  Found in lib/build-qunit-tree.js - About 2 hrs to fix

                    Function default has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function(babel, _options) {
                      var options = _options || {};
                    
                      function htmlbarsInlineCompilerPlugin(babel) {
                        let t = babel.types;
                    Severity: Major
                    Found in app/plugins/hbs-plugin.js - About 2 hrs to fix

                      Function resolveAddonsTask has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        resolveAddonsTask: task(function *(addons, dependencies, emberVersion) {
                          let done = false;
                          while (!done) {
                            let addonPromises = {};
                            let addonNames = Object.keys(addons);
                      Severity: Major
                      Found in app/services/dependency-resolver.js - About 2 hrs to fix

                        Function htmlbarsInlineCompilerPlugin has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function htmlbarsInlineCompilerPlugin(babel) {
                            let t = babel.types;
                        
                            return {
                              visitor: {
                        Severity: Minor
                        Found in app/plugins/hbs-plugin.js - About 2 hrs to fix

                          Function testConfig has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function testConfig() {
                          
                            this.get('/gists', function(schema) {
                              return schema.gists.all();
                            });
                          Severity: Minor
                          Found in mirage/config.js - About 1 hr to fix

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

                              initializeColumns() {
                                const files = this.get('model.files');
                            
                                if (!files) {
                                  return;
                            Severity: Minor
                            Found in app/mixins/columns.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