slm-lang/slm

View on GitHub

Showing 41 of 71 total issues

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

StaticMerger.prototype.on_multi = function(exps) {
  var res = ['multi'], node;

  for (var i = 1, l = exps.length; i < l; i++) {
    var exp = exps[i];
Severity: Minor
Found in lib/filters/static_merger.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 _parseLine has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

p._parseLine = function() {
  if (emptyLineRe.test(this._line)) {
    this._pushOnTop(['newline']);
    return;
  }
Severity: Minor
Found in lib/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 _parseJSCode has 35 lines of code (exceeds 25 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 1 hr to fix

    Function assertHtml has a Cognitive Complexity of 11 (exceeds 5 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

    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 content has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    VMProto.content = function() {
      var cb, mod, name;
      switch (arguments.length) {
        case 0: // return main content
          return safe(this.res);
    Severity: Minor
    Found in lib/vm.js - About 1 hr to fix

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

      p._parseLine = function() {
        if (emptyLineRe.test(this._line)) {
          this._pushOnTop(['newline']);
          return;
        }
      Severity: Minor
      Found in lib/parser.js - About 1 hr to fix

        Function on_html_attr has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        p.on_html_attr = function(exps) {
          var name = exps[2], value = exps[3];
          if (value[0] === 'slm' && value[1] === 'attrvalue' && !this._mergeAttrs[name]) {
            // We handle the attribute as a boolean attribute
            var escape = value[2], code = value[3];
        Severity: Minor
        Found in lib/filters/code_attributes.js - About 1 hr to fix

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

          p.on_slm_interpolate = function(exps) {
            var str = exps[2], m, code;
          
            // Interpolate variables in text (${variable}).
            // Split the text into multiple dynamic and static parts.
          Severity: Minor
          Found in lib/filters/interpolate.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

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

          slm.__express = function(path, options, fn) {
            FS.readFile(path, 'utf-8', function (err, src) {
              if (err) {
                return fn(new Error(err));
              }
          Severity: Minor
          Found in lib/slm.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

          Function on_multi has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          MultiFlattener.prototype.on_multi = function(exps) {
            // If the multi contains a single element, just return the element
            var len = exps.length;
            if (len === 2) {
              return this.compile(exps[1]);
          Severity: Minor
          Found in lib/filters/multi_flattener.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

          Avoid deeply nested control flow statements.
          Open

                    if (j) {
                      exp.push(['static', delimiter]);
                    }
          Severity: Major
          Found in lib/filters/attr_merge.js - About 45 mins to fix

            Function _isContainNonEmptyStatic has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            p._isContainNonEmptyStatic = function(exp) {
              switch (exp[0]) {
              case 'multi':
                for (var i = 1, l = exp.length; i < l; i++) {
                  if (this._isContainNonEmptyStatic(exp[i])) {
            Severity: Minor
            Found in lib/html/html.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 on_html_doctype has a Cognitive Complexity of 7 (exceeds 5 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 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

            Function _isEmptyExp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            p._isEmptyExp = function(exp) {
              switch (exp[0]) {
              case 'multi':
                for (var i = 1, l = exp.length; i < l; i++) {
                  if (!this._isEmptyExp(exp[i])) {
            Severity: Minor
            Found in lib/filter.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

            Function on_html_attrs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            p.on_html_attrs = function(exps) {
              var names = [], values = {};
              for (var i = 2, l = exps.length; i < l; i++) {
                var attr = exps[i];
                var name = attr[2].toString(), val = attr[3];
            Severity: Minor
            Found in lib/filters/attr_merge.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

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

            p.on_html_tag = function(exps) {
              var name = exps[2].toString(), attrs = exps[3], content = exps[4];
            
              var closed = !content || (this._isEmptyExp(content) && (this._format === 'xml' || this._autoclose.indexOf(name) !== -1));
            
            
            Severity: Minor
            Found in lib/html/fast.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

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

            p._resolvePath = function(path) {
              var basename = Path.basename,
                  dirname  = Path.dirname,
                  join = Path.join;
            
            
            Severity: Minor
            Found in lib/vm_node.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

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

            VMProto.content = function() {
              var cb, mod, name;
              switch (arguments.length) {
                case 0: // return main content
                  return safe(this.res);
            Severity: Minor
            Found in lib/vm.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

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

            p._parseExpression = function(str) {
              for (var count = 1, i = 0, l = str.length; i < l && count; i++) {
                if (str[i] === '{') {
                  count++;
                } else if (str[i] === '}') {
            Severity: Minor
            Found in lib/filters/interpolate.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

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

            p._expandCode = function(code, postCode) {
                var index, m = callbackRe.exec(code);
                if (m) {
                  index = m.index + m[1].length;
                  postCode += code.slice(index);
            Severity: Minor
            Found in lib/filters/brackets.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