taburetkin/marionette.yat

View on GitHub
utils/build-utils.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function normalizeArgs has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function normalizeArgs(ownArgs, cmnArgs, cmnArgsIndex = 0, ownArgsIndex = 0) {
    if (cmnArgs == null && ownArgs == null) {

        return;

Severity: Minor
Found in utils/build-utils.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

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

export function buildInstanceByKey(context, key, buildOptions = {}) {
    if (!buildOptions.ctorArgs) {
        let { keyToCamelCase, defaultOptions, options, optionsKey } = buildOptions;
        if (!optionsKey) {
            optionsKey = keyToCamelCase ? camelCase(key, 'options') : key + 'Options';
Severity: Minor
Found in utils/build-utils.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 buildItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function buildItem(arg, buildOptions = {}) {
    if (arg == null) return;

    let { BaseClass, ctorArgs, ctorArgsIndex, context } = buildOptions;

Severity: Minor
Found in utils/build-utils.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 merge has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function merge(v1, v2) {
    if (v1 != null && v2 != null) {
        if (_.isObject(v1) && _.isObject(v2)) {
            return _.extend({}, v1, v2);
        } else {
Severity: Minor
Found in utils/build-utils.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

Avoid too many return statements within this function.
Open

        return create(arg.class, args);
Severity: Major
Found in utils/build-utils.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return buildOptions.buildFromText(arg, ...buildOptions.ctorArgs);
    Severity: Major
    Found in utils/build-utils.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return ownArgs || cmnArgs;
      Severity: Major
      Found in utils/build-utils.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return merge(ownArgs, cmnArgs);
        Severity: Major
        Found in utils/build-utils.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return arg.buid.call(context, arg, ctorArgs, buildOptions, context);
          Severity: Major
          Found in utils/build-utils.js - About 30 mins to fix

            Function buildByKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            export function buildByKey(context, key, buildOptions = {}) {
                let getOptions = extractGetOptions(buildOptions);
                let arg;
                if (isClass(key, buildOptions.BaseClass)) {
                    arg = key;
            Severity: Minor
            Found in utils/build-utils.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

            There are no issues that match your filters.

            Category
            Status