src/system/index.js
System
has 62 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class System {
constructor(manifest, name, image, options = {}) {
this.manifest = manifest;
this.name = name;
File index.js
has 530 lines of code (exceeds 250 allowed). Consider refactoring. Open
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({
Function _make_options
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_make_options(daemon, options = {}, image_conf = {}) {
// Default values
options = _.defaults(options, {
workdir: this.options.workdir,
mounts: {},
Function _mounts_to_volumes
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_mounts_to_volumes(mounts, daemon = true) {
var volumes = {};
// persistent folder
var persist_base = config('paths:persistent_folders');
Function daemonOptions
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
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;
Function expandExportEnvs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
expandExportEnvs(data) {
var ports, envs = {};
// Defaults options
data = _.defaults(data, { envs: {}, net: {}, });
Function daemonOptions
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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;
- Read upRead up
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
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);
- Read upRead up
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"