amzn/style-dictionary

View on GitHub

Showing 182 of 182 total issues

Method getNodeArrayForObject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static ArrayList<StyleDictionaryNode> getNodeArrayForObject(JSONObject json) {
        final ArrayList<StyleDictionaryNode> nodeList = new ArrayList<>();
        Iterator<String> keys = json.keys();
        while(keys.hasNext()) {
            String key = keys.next();

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 propertySetup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function propertySetup(property, name, path) {
  if (!property && !_.isPlainObject(property))
    throw new Error('Property object must be an object');
  if (!name || !_.isString(name))
    throw new Error('Name must be a string');
Severity: Minor
Found in lib/transform/propertySetup.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

Severity
Category
Status
Source
Language