azukiapp/azk

View on GitHub

Showing 207 of 207 total issues

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

export class Suggestion extends DefaultSuggestion {
  constructor(...args) {
    super(...args);

    var name    = 'python_django';
Severity: Major
Found in src/generator/suggestions/python_django-3.4.js and 1 other location - About 6 hrs to fix
src/generator/suggestions/python_django-2.7.js on lines 3..21

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

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 class Suggestion extends DefaultSuggestion {
  constructor(...args) {
    super(...args);

    var name    = 'python_django';
Severity: Major
Found in src/generator/suggestions/python_django-2.7.js and 1 other location - About 6 hrs to fix
src/generator/suggestions/python_django-3.4.js on lines 3..21

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

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 configure.js has 393 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { _, t, os, log, lazy_require, fsAsync } from 'azk';
import { publish } from 'azk/utils/postal';
import { async, promisify, thenAll, promiseResolve } from 'azk/utils/promises';
import { config, set_config } from 'azk';
import { UIProxy } from 'azk/cli/ui';
Severity: Minor
Found in src/agent/configure.js - About 5 hrs to fix

    File run.js has 376 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { _, t, lazy_require, isBlank } from 'azk';
    import { config, log, path } from 'azk';
    import { subscribe, publish } from 'azk/utils/postal';
    import { defer, async, asyncUnsubscribe, promiseResolve, thenAll } from 'azk/utils/promises';
    import { ImageNotAvailable, SystemRunError, RunCommandError, NotBeenImplementedError } from 'azk/utils/errors';
    Severity: Minor
    Found in src/system/run.js - About 5 hrs to fix

      Function run has 123 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function run(docker, Container, image, cmd, opts = { }) {
        var container = null;
      
        opts.stdout = opts.stdout  || process.stdout;
        opts.stderr = opts.stderr  || opts.stdout;
      Severity: Major
      Found in src/docker/run.js - About 4 hrs to fix

        Function _scale has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
        Open

          _scale(system, instances = {}, opts = undefined) {
            var flags    = {};
            var _subscription = subscribe('#.status', (event) => {
              if (!event) { return; }
              var type;
        Severity: Minor
        Found in src/cmds/scale.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

        File index.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { path, fs, config, _, t, log, lazy_require, isBlank } from 'azk';
        import { System } from 'azk/system';
        import { Validate } from 'azk/manifest/validate';
        import { ManifestError, ManifestRequiredError, SystemNotFoundError } from 'azk/utils/errors';
        import Utils from 'azk/utils';
        Severity: Minor
        Found in src/manifest/index.js - About 4 hrs to fix

          UI has 31 functions (exceeds 20 allowed). Consider refactoring.
          Open

          var UI = {
            isUI: true,
            t: t,
            _interactive: true,
          
          
          Severity: Minor
          Found in src/cli/ui.js - About 3 hrs to fix

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

            export function build(docker, options) {
              return async(function* () {
                var opts = _.extend({
                  cache: true
                }, options);
            Severity: Major
            Found in src/docker/build.js - About 3 hrs to fix

              Function constructor has 87 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                constructor(opts) {
                  this.opts = _.merge({
                    namespace: config('configuration:namespace'),
                  }, opts);
              
              
              Severity: Major
              Found in src/configuration/index.js - About 3 hrs to fix

                Manifest has 28 functions (exceeds 20 allowed). Consider refactoring.
                Open

                export class Manifest {
                  constructor(cwd, file = null, required = false) {
                    if (typeof file == "boolean") {
                      [required, file] = [file, null];
                    }
                Severity: Minor
                Found in src/manifest/index.js - About 3 hrs to fix

                  Function index has 81 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    index() {
                      var { options } = this.normalized_params;
                      var args = this.normalized_params.arguments;
                  
                      var _subscription = subscribe('docker.pull.status', (data) => {
                  Severity: Major
                  Found in src/cmds/shell.js - About 3 hrs to fix

                    Function _validate_wait_option has 75 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static _validate_wait_option(manifest) {
                        return _.reduce(manifest.systems, (errors, system) => {
                    
                          // ignore if it is not present or equal false
                          if (typeof system.options.wait === 'undefined' || system.options.wait === false) {
                    Severity: Major
                    Found in src/manifest/validate.js - About 3 hrs to fix

                      File balancer.js has 288 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { _, t, path, fsAsync, config, log } from 'azk';
                      import { async, defer, promisifyAll, thenAll, promiseResolve } from 'azk/utils/promises';
                      
                      import { lazy_require } from 'azk';
                      import { net } from 'azk/utils';
                      Severity: Minor
                      Found in src/agent/balancer.js - About 2 hrs to fix

                        Function index has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          index() {
                            return async(this, function* () {
                              let args = this.normalized_params.arguments;
                              let options = this.normalized_params.options;
                        
                        
                        Severity: Major
                        Found in src/cmds/info.js - About 2 hrs to fix

                          Function subscribeTo has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            subscribeTo(topic) {
                              if (topic) {
                                var subscribe_topic = topic;
                                var subscribe = azk_channel.subscribe.bind(azk_channel);
                                var log = require("azk/utils/log").log;
                          Severity: Major
                          Found in src/utils/postal.js - About 2 hrs to fix

                            File get_project.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { path, lazy_require, config, log, fsAsync } from 'azk';
                            import { async, promiseResolve, promiseReject } from 'azk/utils/promises';
                            import { UIProxy } from 'azk/cli/ui';
                            import { matchFirstRegex, matchAllRegex, fulltrim } from 'azk/utils/regex_helper';
                            import { printOutput } from 'azk/utils/spawn_helper';
                            Severity: Minor
                            Found in src/manifest/get_project.js - About 2 hrs to fix

                              Function _scale has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                _scale(system, instances = {}, opts = undefined) {
                                  var flags    = {};
                                  var _subscription = subscribe('#.status', (event) => {
                                    if (!event) { return; }
                                    var type;
                              Severity: Major
                              Found in src/cmds/scale.js - About 2 hrs to fix

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

                                  _make_options(daemon, options = {}, image_conf = {}) {
                                    // Default values
                                    options = _.defaults(options, {
                                      workdir: this.options.workdir,
                                      mounts: {},
                                Severity: Major
                                Found in src/system/index.js - About 2 hrs to fix

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

                                    __convertFoldersToSystems() {
                                      let systems = {};
                                      let not_version = [];
                                  
                                      _.forEach(this.__folder_evidences_suggestion, function(folder_evidence_suggestion) {
                                  Severity: Major
                                  Found in src/generator/court.js - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language