amzn/style-dictionary

View on GitHub

Showing 33 of 182 total issues

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

function combineJSON(arr, deep, collision) {
  var i, files = [],
    to_ret = {};

  for (i = 0; i < arr.length; i++) {
Severity: Minor
Found in lib/utils/combineJSON.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

Avoid deeply nested control flow statements.
Open

          if ( copyIsArray ) {
            copyIsArray = false;
            clone = src && _.isArray(src) ? src : [];
          } else {
            clone = src && _.isPlainObject(src) ? src : {};
Severity: Major
Found in lib/utils/deepExtend.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            } else if ( copy !== undefined ) {
              if (src != null && typeof collision == 'function') {
                collision({target: target, copy: options, path: path, key: name});
              }
              target[ name ] = copy;
    Severity: Major
    Found in lib/utils/deepExtend.js - About 45 mins to fix

      Function minifyDictionary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      function minifyDictionary(obj) {
        var toRet = {};
        if (obj.hasOwnProperty('value')) {
          return obj.value;
        } else {
      Severity: Minor
      Found in lib/common/formats.js - About 45 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 cleanDir has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function cleanDir(destination, format, platform, dictionary, filter) {
      Severity: Minor
      Found in lib/cleanDir.js - About 35 mins to fix

        Function buildFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function buildFile(destination, format, platform, dictionary, filter) {
        Severity: Minor
        Found in lib/buildFile.js - About 35 mins to fix

          Function cleanFile has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function cleanFile(destination, format, platform, dictionary, filter) {
          Severity: Minor
          Found in lib/cleanFile.js - About 35 mins to fix

            Method getAllBaseColors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                protected ArrayList<BaseColorListItem> getAllBaseColors() {
                    ArrayList<StyleDictionaryNode> baseColors = getBaseColorList();
                    ArrayList<BaseColorListItem> allColors = new ArrayList<>();
                    ArrayList<String> path = new ArrayList<>();
                    path.add("color");

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

            function buildFile(destination, format, platform, dictionary, filter) {
              if (typeof format !== 'function')
                throw new Error('Please enter a valid file format');
              if (typeof destination !== 'string')
                throw new Error('Please enter a valid destination');
            Severity: Minor
            Found in lib/buildFile.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

            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

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

            function registerTransform(options) {
              if (typeof options.type !== 'string')
                throw new Error('type must be a string');
              if (transformTypes.indexOf(options.type) < 0)
                throw new Error(options.type + ' type is not one of: ' + transformTypes.join(', '));
            Severity: Minor
            Found in lib/register/transform.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

            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