azukiapp/azk

View on GitHub
src/system/index.js

Summary

Maintainability
F
3 days
Test Coverage

System has 62 functions (exceeds 20 allowed). Consider refactoring.
Open

export class System {
  constructor(manifest, name, image, options = {}) {
    this.manifest  = manifest;
    this.name      = name;

Severity: Major
Found in src/system/index.js - About 1 day to fix

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

    import { _, t, path, fs, utils, isBlank, lazy_require } from 'azk';
    import { version, config } from 'azk';
    import { net } from 'azk/utils';
    
    var lazy = lazy_require({
    Severity: Major
    Found in src/system/index.js - About 1 day 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 _mounts_to_volumes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _mounts_to_volumes(mounts, daemon = true) {
            var volumes = {};
        
            // persistent folder
            var persist_base = config('paths:persistent_folders');
        Severity: Minor
        Found in src/system/index.js - About 1 hr to fix

          Function daemonOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            daemonOptions(options = {}, image_conf = {}) {
              // Merge ports
              options.ports = _.merge({}, this.ports, options.ports);
              options.ports_order = _.map(options.ports, (port, name) => {
                return !_.isEmpty(port) && name;
          Severity: Minor
          Found in src/system/index.js - About 1 hr to fix

            Function expandExportEnvs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              expandExportEnvs(data) {
                var ports, envs = {};
            
                // Defaults options
                data = _.defaults(data, { envs: {}, net: {}, });
            Severity: Minor
            Found in src/system/index.js - About 1 hr to fix

              Function daemonOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                daemonOptions(options = {}, image_conf = {}) {
                  // Merge ports
                  options.ports = _.merge({}, this.ports, options.ports);
                  options.ports_order = _.map(options.ports, (port, name) => {
                    return !_.isEmpty(port) && name;
              Severity: Minor
              Found in src/system/index.js - About 55 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 _daemon_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _daemon_command(options, image_conf) {
                  var command         = options.command || this.command;
                  var empty_img_cmd   = _.isEmpty(image_conf.Cmd);
                  var empty_img_entry = _.isEmpty(image_conf.Entrypoint);
                  var empty_cmd       = _.isEmpty(command);
              Severity: Minor
              Found in src/system/index.js - About 35 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

              There are no issues that match your filters.

              Category
              Status