syntheticore/declaire

View on GitHub
src/parser.js

Summary

Maintainability
D
1 day
Test Coverage

Function parseStatement has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseStatement: function(line) {
    var m;
    var out;
    // if
    if(m = line.match(/{{if\s+(.+)}}/)) {
Severity: Major
Found in src/parser.js - About 2 hrs to fix

    File parser.js has 281 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    var _ = require('./utils.js');
    
    
    // Breadth-first walk the tree in reverse order
    var inverseBreadth = function(node, cb) {
    Severity: Minor
    Found in src/parser.js - About 2 hrs to fix

      Function parseTemplate has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        parseTemplate: function(tmpl) {
          var self = this;
          var lines = tmpl.split('\n');
          var lastIndent = 0;
          var lineNum = 0;
      Severity: Major
      Found in src/parser.js - About 2 hrs to fix

        Function parseTag has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          parseTag: function(line) {
            var self = this;
            var m = line.match(/(([\w-#\.]+\s*>\s*)*)([\w-]+)?(#([\w-]+))?((\.[\w-]+)*)(\((.*)\))?(\+)?( (.*))?/);
            var multiTags = m[1];
            var tag = m[3] || 'div';
        Severity: Major
        Found in src/parser.js - About 2 hrs to fix

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

            parseStatement: function(line) {
              var m;
              var out;
              // if
              if(m = line.match(/{{if\s+(.+)}}/)) {
          Severity: Minor
          Found in src/parser.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 cleanTree has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          var cleanTree = function(node) {
            if(node.children) {
              for(var i = node.children.length - 1; i >= 0; i--) {
                var child = node.children[i];
                if(child.type == 'Alternative') {
          Severity: Minor
          Found in src/parser.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 parseTag has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            parseTag: function(line) {
              var self = this;
              var m = line.match(/(([\w-#\.]+\s*>\s*)*)([\w-]+)?(#([\w-]+))?((\.[\w-]+)*)(\((.*)\))?(\+)?( (.*))?/);
              var multiTags = m[1];
              var tag = m[3] || 'div';
          Severity: Minor
          Found in src/parser.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 parseAttribute has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            parseAttribute: function(str) {
              var attr = {type: 'static', value: str};
              // Dynamic attribute
              if(str[0] == '{') {
                // Trim off curlies
          Severity: Minor
          Found in src/parser.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

          There are no issues that match your filters.

          Category
          Status