amzn/style-dictionary

View on GitHub

Showing 33 of 182 total issues

File transforms.test.js has 553 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
Severity: Major
Found in __tests__/common/transforms.test.js - About 1 day to fix

    Function deepExtend has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

    function deepExtend(objects, collision, path) {
      if (objects == null)
        return {};
    
      var src, copyIsArray, copy, name, options, clone,
    Severity: Minor
    Found in lib/utils/deepExtend.js - About 7 hrs 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 transformConfig has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    function transformConfig(config, dictionary, platformName) {
      var to_ret = _.clone(config);
    
      // The platform can define either a transformGroup or an array
      // of transforms. If given a transformGroup that doesn't exist,
    Severity: Minor
    Found in lib/transform/config.js - About 6 hrs 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

    File transforms.js has 405 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*
     * Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
     *
     * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
     * the License. A copy of the License is located at
    Severity: Minor
    Found in lib/common/transforms.js - About 5 hrs to fix

      Function transformConfig has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function transformConfig(config, dictionary, platformName) {
        var to_ret = _.clone(config);
      
        // The platform can define either a transformGroup or an array
        // of transforms. If given a transformGroup that doesn't exist,
      Severity: Major
      Found in lib/transform/config.js - About 3 hrs to fix

        File resolveObject.test.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
         * Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
         *
         * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
         * the License. A copy of the License is located at
        Severity: Minor
        Found in __tests__/utils/resolveObject.test.js - About 2 hrs to fix

          Function buildFile has 50 lines of code (exceeds 25 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 2 hrs to fix

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

            function transformProperty(property, options) {
              var to_ret = _.clone(property);
              var transforms = options.transforms;
            
              for(var i = 0; i < transforms.length; i++ ) {
            Severity: Minor
            Found in lib/transform/property.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 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 deepExtend has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function deepExtend(objects, collision, path) {
              if (objects == null)
                return {};
            
              var src, copyIsArray, copy, name, options, clone,
            Severity: Minor
            Found in lib/utils/deepExtend.js - About 1 hr to fix

              Function extend has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

              function extend(opts) {
                var options, to_ret;
              
                // Overloaded method, can accept a string as a path that points to a JS or
                // JSON file or a plain object. Potentially refactor.
              Severity: Minor
              Found in lib/extend.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 getStyleDictionaryConfig has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getStyleDictionaryConfig(brand, platform) {
                return {
                  "source": [
                    `properties/brands/${brand}/*.json`,
                    "properties/globals/**/*.json",
              Severity: Minor
              Found in examples/advanced/multi-brand-multi-platform/build.js - About 1 hr to fix

                Function files has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  to_ret.files = (config.files || []).map(function(file) {
                    const ext = {};
                    if (file.filter) {
                      if(typeof file.filter === 'string') {
                        if (dictionary.filter[file.filter]) {
                Severity: Minor
                Found in lib/transform/config.js - About 1 hr to fix

                  Function transformObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function transformObject(obj, options, path, to_ret) {
                    to_ret = to_ret || {};
                    path = path || [];
                  
                    for(var name in obj) {
                  Severity: Minor
                  Found in lib/transform/object.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 extend has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function extend(opts) {
                      var options, to_ret;
                    
                      // Overloaded method, can accept a string as a path that points to a JS or
                      // JSON file or a plain object. Potentially refactor.
                    Severity: Minor
                    Found in lib/extend.js - About 1 hr to fix

                      Function registerValidSW has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function registerValidSW(swUrl, config) {
                        navigator.serviceWorker
                          .register(swUrl)
                          .then(registration => {
                            registration.onupdatefound = () => {
                      Severity: Minor
                      Found in examples/advanced/create-react-app/src/serviceWorker.js - About 1 hr to fix

                        Function flattenProperties has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function flattenProperties(properties, to_ret) {
                          to_ret = to_ret || [];
                        
                          for(var name in properties) {
                            if (properties.hasOwnProperty(name)) {
                        Severity: Minor
                        Found in lib/utils/flattenProperties.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

                        Method onCreate has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            protected void onCreate(Bundle savedInstanceState) {
                                super.onCreate(savedInstanceState);
                                setContentView(R.layout.activity_property_detail);
                        
                        

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

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

                          Severity
                          Category
                          Status
                          Source
                          Language