vgno/data-shaper

View on GitHub

Showing 6 of 6 total issues

Function resolveValue has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function resolveValue(sourceData, reference, options, callback) {
    var fetchData = options.fetchData;

    // We got a null reference, meaning that the resolving of a reverse
    // reference is done
Severity: Major
Found in lib/resolve-value.js - About 2 hrs to fix

    Function resolveFragment has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function resolveFragment(data, fragment, options, callback) {
        var resolveValue = options.resolveValue;
        var fetchData = options.fetchData;
    
        var reference = fragment.reference;
    Severity: Minor
    Found in lib/resolve-fragment.js - About 1 hr to fix

      Function shapeData has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function shapeData(data, shape, options, callback) {
          var resolveValue = options.resolveValue;
          var resolveFragment = options.resolveFragment;
      
          var responseData = {};
      Severity: Minor
      Found in lib/shape-data.js - About 1 hr to fix

        Function dataShaper has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function dataShaper(data, shape, options, callback) {
            var shaperOptions = merge({
                shapeData: shapeData,
                resolveValue: resolveValue,
                resolveFragment: resolveFragment,
        Severity: Minor
        Found in index.js - About 1 hr to fix

          Function getReverseReferenceData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getReverseReferenceData(reference) {
              var match = reference.match(refRegex);
          
              // Return null if the reference is malformed in some way
              if (match === null) {
          Severity: Minor
          Found in lib/helpers.js - About 1 hr to fix

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

            function getReverseReferenceData(reference) {
                var match = reference.match(refRegex);
            
                // Return null if the reference is malformed in some way
                if (match === null) {
            Severity: Minor
            Found in lib/helpers.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