amzn/style-dictionary

View on GitHub
lib/utils/resolveObject.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

function traverseObj(obj) {
  var key;

  for (key in obj) {
    // We want to check for ignoredKeys, this is to
Severity: Minor
Found in lib/utils/resolveObject.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 compile_value has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function compile_value(value, stack) {

  var to_ret, ref;

  // Replace the reference inline, but don't replace the whole string because
Severity: Minor
Found in lib/utils/resolveObject.js - About 1 hr to fix

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

    function selfRef(str, obj) {
      var i,
          ref=obj,
          array = str.split(options.separator),
          context = current_context.join(options.separator);
    Severity: Minor
    Found in lib/utils/resolveObject.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