GeoKnow/Jassa-Core

View on GitHub
lib/sponate/TemplateParser.js

Summary

Maintainability
B
5 hrs
Test Coverage

File TemplateParser.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var uniq = require('lodash.uniq');

var Class = require('../ext/Class');

var ObjectUtils = require('../util/ObjectUtils');
Severity: Minor
Found in lib/sponate/TemplateParser.js - About 2 hrs to fix

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

        parseArrayDynamic: function(val) {
    
            if (val.length !== 1) {
                throw new Error('[ERROR] Arrays must have exactly one element that is either a string or an object', val);
            }
    Severity: Minor
    Found in lib/sponate/TemplateParser.js - About 1 hr to fix

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

          parseAgg: function(val) {
      
              // console.log('PARSING: ' + JSON.stringify(val));
      
              var result;
      Severity: Minor
      Found in lib/sponate/TemplateParser.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 parseArrayDynamic has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          parseArrayDynamic: function(val) {
      
              if (val.length !== 1) {
                  throw new Error('[ERROR] Arrays must have exactly one element that is either a string or an object', val);
              }
      Severity: Minor
      Found in lib/sponate/TemplateParser.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

      There are no issues that match your filters.

      Category
      Status