slm-lang/slm

View on GitHub

Showing 71 of 71 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  gulp.src('lib/slm_browser.js')
  .pipe(_.webpack({
      output: {
        filename: 'slm-browser.js',
        library: 'Slm',
Severity: Major
Found in Gulpfile.js and 1 other location - About 1 day to fix
Gulpfile.js on lines 65..82

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 226.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  gulp.src('lib/vm_browser.js')
  .pipe(_.webpack({
      output: {
        filename: 'slm-vm-browser.js',
        library: 'SlmVM',
Severity: Major
Found in Gulpfile.js and 1 other location - About 1 day to fix
Gulpfile.js on lines 31..48

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 226.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          test('wraps if statement', function() {
            expect(
              filter.exec(['multi', ['slm', 'control', 'if this.x > 0',
                              ['multi',
                                ['newline'],
        Severity: Major
        Found in __tests__/filters/brackets.js and 4 other locations - About 3 hrs to fix
        __tests__/filters/brackets.js on lines 32..49
        __tests__/filters/brackets.js on lines 51..68
        __tests__/filters/brackets.js on lines 102..119
        __tests__/filters/brackets.js on lines 121..138

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          test('not wraps wrapped if statement', function() {
            expect(
              filter.exec(['multi', ['slm', 'control', 'if (this.x > 0)',
                              ['multi', ['newline'],
                                ['html', 'tag', 'p',
        Severity: Major
        Found in __tests__/filters/brackets.js and 4 other locations - About 3 hrs to fix
        __tests__/filters/brackets.js on lines 11..30
        __tests__/filters/brackets.js on lines 32..49
        __tests__/filters/brackets.js on lines 102..119
        __tests__/filters/brackets.js on lines 121..138

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          test('wraps for loop', function() {
            expect(
              filter.exec(['multi', ['slm', 'control', 'for i = 0; i < items.length; i++',
                              ['multi', ['newline'],
                                ['html', 'tag', 'p',
        Severity: Major
        Found in __tests__/filters/brackets.js and 4 other locations - About 3 hrs to fix
        __tests__/filters/brackets.js on lines 11..30
        __tests__/filters/brackets.js on lines 32..49
        __tests__/filters/brackets.js on lines 51..68
        __tests__/filters/brackets.js on lines 121..138

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          test('wraps if statement with spaces', function() {
            expect(
              filter.exec(['multi', ['slm', 'control', 'if   this.x > 0  ',
                              ['multi', ['newline'],
                                ['html', 'tag', 'p',
        Severity: Major
        Found in __tests__/filters/brackets.js and 4 other locations - About 3 hrs to fix
        __tests__/filters/brackets.js on lines 11..30
        __tests__/filters/brackets.js on lines 51..68
        __tests__/filters/brackets.js on lines 102..119
        __tests__/filters/brackets.js on lines 121..138

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

          test('wraps while loop', function() {
            expect(
              filter.exec(['multi', ['slm', 'control', 'while i < 10',
                              ['multi', ['newline'],
                                ['html', 'tag', 'p',
        Severity: Major
        Found in __tests__/filters/brackets.js and 4 other locations - About 3 hrs to fix
        __tests__/filters/brackets.js on lines 11..30
        __tests__/filters/brackets.js on lines 32..49
        __tests__/filters/brackets.js on lines 51..68
        __tests__/filters/brackets.js on lines 102..119

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 114.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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
                Severity
                Category
                Status
                Source
                Language