slm-lang/slm

View on GitHub

Showing 41 of 71 total issues

File html_structure.js has 542 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var Template = require('../../lib/template');
var assertHtml = require('../helper').assertHtml;

describe('Html structure', function() {

Severity: Major
Found in __tests__/core/html_structure.js - About 1 day to fix

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

    var attrDelimRe = /^\s*([\(\)\[\]])/;
    var blockExpressionRe = /^\s*:\s*/;
    var closedTagRe = /^\s*\/\s*/;
    var delimRe = /^[\(\[]/;
    var doctypeRe = /^doctype\b/i;
    Severity: Major
    Found in lib/parser.js - About 1 day to fix

      Function mixin has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

      VMProto.mixin = function() {
        var name = arguments[0];
      
        var lastArgument = arguments[arguments.length - 1];
        if (typeof lastArgument === 'function') { // mixin definition
      Severity: Minor
      Found in lib/vm.js - About 4 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 _parseTag has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      p._parseTag = function(tag) {
        var m, trailingWS, leadingWS;
        if (tagShortcut[tag]) {
          tag = tagShortcut[tag];
        }
      Severity: Minor
      Found in lib/parser.js - About 4 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 _merge has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      p._merge = function(names, values) {
        var attrs = [];
        for (var i = 0, il = names.length; i < il; i++) {
          var name = names[i];
          var value = values[name], delimiter = this._mergeAttrs[name];
      Severity: Minor
      Found in lib/filters/attr_merge.js - About 4 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 _parseTextBlock has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

      p._parseTextBlock = function(firstLine, textIndent, inTag) {
        var result = ['multi'];
      
        if (!firstLine || !firstLine.length) {
          textIndent = null;
      Severity: Minor
      Found in lib/parser.js - About 4 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 code_structure.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var Template = require('../../lib/template');
      var assertHtml = require('../helper').assertHtml;
      
      describe('Code structure', function() {
        var template;
      Severity: Minor
      Found in __tests__/core/code_structure.js - About 4 hrs to fix

        Function _parseJSCode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

        p._parseJSCode = function(outerDelimeter) {
          var code = '', count = 0, delimiter, closeDelimiter, m;
        
          // Attribute ends with space or attribute delimiter
          var endRe = new RegExp('^[\\s' + this._escapeRegExp(outerDelimeter) + ']');
        Severity: Minor
        Found in lib/parser.js - About 3 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 vm_node.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var Template = require('../lib/template');
        var FS = require('fs');
        
        describe('VMNode', function() {
          var fixture = {};
        Severity: Minor
        Found in __tests__/vm_node.js - About 3 hrs to fix

          Function _parseTag has 75 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          p._parseTag = function(tag) {
            var m, trailingWS, leadingWS;
            if (tagShortcut[tag]) {
              tag = tagShortcut[tag];
            }
          Severity: Major
          Found in lib/parser.js - About 3 hrs to fix

            Function mixin has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            VMProto.mixin = function() {
              var name = arguments[0];
            
              var lastArgument = arguments[arguments.length - 1];
              if (typeof lastArgument === 'function') { // mixin definition
            Severity: Major
            Found in lib/vm.js - About 2 hrs to fix

              Function _parseAttributes has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

              p._parseAttributes = function(attributes) {
                // Check to see if there is a delimiter right after the tag name
                var delimiter, m;
              
                m = attrDelimRe.exec(this._line);
              Severity: Minor
              Found in lib/parser.js - About 2 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 _parseAttributes has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              p._parseAttributes = function(attributes) {
                // Check to see if there is a delimiter right after the tag name
                var delimiter, m;
              
                m = attrDelimRe.exec(this._line);
              Severity: Major
              Found in lib/parser.js - About 2 hrs to fix

                Function _parseQuotedAttribute has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                p._parseQuotedAttribute = function(quote) {
                  var value = '', count = 0;
                
                  while (count !== 0 || this._line[0] !== quote) {
                    var m = /^(\\)?$/.exec(this._line);
                Severity: Minor
                Found in lib/parser.js - About 2 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

                Consider simplifying this complex logical expression.
                Open

                    if (
                      // HTML comment
                      this._matchLineThen(htmlCommentRe, _parseHtmlComment) ||
                      // or HTML conditional comment
                      this._matchLineThen(htmlConditionalCommentRe, _parseHtmlConditionalComment) ||
                Severity: Critical
                Found in lib/parser.js - About 2 hrs to fix

                  Function assertHtml has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.assertHtml = function(template, src, result, options) {
                  
                    if (Array.isArray(src)) {
                      src = src.join('\n');
                    }
                  Severity: Minor
                  Found in __tests__/helper.js - About 1 hr to fix

                    Function escape has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function escape(str) {
                      if (typeof str !== 'string') {
                        if (!str) {
                          return '';
                        }
                    Severity: Minor
                    Found in lib/vm.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 on_html_doctype has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    p.on_html_doctype = function(exps) {
                      var type = exps[2];
                    
                      var html = '<!DOCTYPE html>';
                    
                    
                    Severity: Minor
                    Found in lib/html/fast.js - About 1 hr to fix

                      Function _parseTextBlock has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      p._parseTextBlock = function(firstLine, textIndent, inTag) {
                        var result = ['multi'];
                      
                        if (!firstLine || !firstLine.length) {
                          textIndent = null;
                      Severity: Minor
                      Found in lib/parser.js - About 1 hr to fix

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

                        p._merge = function(names, values) {
                          var attrs = [];
                          for (var i = 0, il = names.length; i < il; i++) {
                            var name = names[i];
                            var value = values[name], delimiter = this._mergeAttrs[name];
                        Severity: Minor
                        Found in lib/filters/attr_merge.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language