dist/es6.tmpl.js

Summary

Maintainability
F
1 mo
Test Coverage

Function brackets has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
Open

var brackets = (function (UNDEF) {

  var
    REGLOB = 'g',

Severity: Minor
Found in dist/es6.tmpl.js - About 1 day 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 tmpl has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
Open

var tmpl = (function () {

  var _cache = {}

  function _tmpl (str, data) {
Severity: Minor
Found in dist/es6.tmpl.js - About 1 day 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 brackets has 173 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var brackets = (function (UNDEF) {

  var
    REGLOB = 'g',

Severity: Major
Found in dist/es6.tmpl.js - About 6 hrs to fix

    Function tmpl has 149 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var tmpl = (function () {
    
      var _cache = {}
    
      function _tmpl (str, data) {
    Severity: Major
    Found in dist/es6.tmpl.js - About 5 hrs to fix

      File es6.tmpl.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      
      /**
       * The riot template engine
       * @version v3.0.8
       */
      Severity: Minor
      Found in dist/es6.tmpl.js - About 5 hrs to fix

        Function skipRegex has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
        Open

        var skipRegex = (function () { //eslint-disable-line no-unused-vars
        
          var beforeReChars = '[{(,;:?=|&!^~>%*/'
        
          var beforeReWords = [
        Severity: Minor
        Found in dist/es6.tmpl.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 split has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _brackets.split = function split (str, tmpl, _bp) {
            // istanbul ignore next: _bp is for the compiler
            if (!_bp) _bp = _cache
        
            var
        Severity: Major
        Found in dist/es6.tmpl.js - About 2 hrs to fix

          Function skipRegex has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var skipRegex = (function () { //eslint-disable-line no-unused-vars
          
            var beforeReChars = '[{(,;:?=|&!^~>%*/'
          
            var beforeReWords = [
          Severity: Major
          Found in dist/es6.tmpl.js - About 2 hrs to fix

            Function _parseExpr has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function _parseExpr (expr, asText, qstr) {
            
                expr = expr
                  .replace(/\s+/g, ' ').trim()
                  .replace(/\ ?([[\({},?\.:])\ ?/g, '$1')
            Severity: Minor
            Found in dist/es6.tmpl.js - About 1 hr to fix

              Function _getTmpl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function _getTmpl (str) {
                  var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1)
                  var qstr = parts.qblocks
                  var expr
              
              
              Severity: Minor
              Found in dist/es6.tmpl.js - About 1 hr to fix

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

                  function _skipRegex (code, start) {
                
                    var re = /.*/g
                    var pos = re.lastIndex = start++
                    var match = re.exec(code)[0].match(RE_REGEX)
                Severity: Minor
                Found in dist/es6.tmpl.js - About 1 hr to fix

                  Function _wrapExpr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function _wrapExpr (expr, asText, key) {
                      var tb
                  
                      expr = expr.replace(JS_VARNAME, function (match, p, mvar, pos, s) {
                        if (mvar) {
                  Severity: Minor
                  Found in dist/es6.tmpl.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                            while (--pos >= 0 && RE_VN_CHAR.test(code[pos]));
                    Severity: Major
                    Found in dist/es6.tmpl.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (match[1]) {
                                    if (match[1] === ch) ++ix
                                    else if (!--ix) break
                                  } else {
                                    rech.lastIndex = pushQBlock(match.index, rech.lastIndex, match[2])
                      Severity: Major
                      Found in dist/es6.tmpl.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                if (~beforeReWords.indexOf(code.slice(pos + 1, end))) {
                                  start = next
                                }
                        Severity: Major
                        Found in dist/es6.tmpl.js - About 45 mins to fix

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

                          var brackets = (function (UNDEF) {
                          
                            var
                              REGLOB = 'g',
                          
                          
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 1 wk to fix
                          dist/csp.tmpl.js on lines 7268..7493
                          dist/tmpl.js on lines 93..318

                          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 1745.

                          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

                          var skipRegex = (function () { //eslint-disable-line no-unused-vars
                          
                            var beforeReChars = '[{(,;:?=|&!^~>%*/'
                          
                            var beforeReWords = [
                          Severity: Major
                          Found in dist/es6.tmpl.js and 1 other location - About 2 days to fix
                          dist/csp.tmpl.js on lines 7179..7255

                          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 495.

                          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 3 locations. Consider refactoring.
                          Open

                            function _parseExpr (expr, asText, qstr) {
                          
                              expr = expr
                                .replace(/\s+/g, ' ').trim()
                                .replace(/\ ?([[\({},?\.:])\ ?/g, '$1')
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 2 days to fix
                          dist/csp.tmpl.js on lines 7608..7658
                          dist/tmpl.js on lines 433..483

                          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 431.

                          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 3 locations. Consider refactoring.
                          Open

                            function _getTmpl (str) {
                              var parts = brackets.split(str.replace(RE_DQUOTE, '"'), 1)
                              var qstr = parts.qblocks
                              var expr
                          
                          
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 1 day to fix
                          dist/csp.tmpl.js on lines 7556..7598
                          dist/tmpl.js on lines 381..423

                          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 323.

                          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 3 locations. Consider refactoring.
                          Open

                            function _wrapExpr (expr, asText, key) {
                              var tb
                          
                              expr = expr.replace(JS_VARNAME, function (match, p, mvar, pos, s) {
                                if (mvar) {
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 1 day to fix
                          dist/csp.tmpl.js on lines 7666..7701
                          dist/tmpl.js on lines 491..526

                          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 314.

                          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

                          Identical blocks of code found in 3 locations. Consider refactoring.
                          Open

                            function _logErr (err, ctx) {
                          
                              err.riotData = {
                                tagName: ctx && ctx.__ && ctx.__.tagName,
                                _riot_id: ctx && ctx._riot_id  //eslint-disable-line camelcase
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 6 hrs to fix
                          dist/csp.tmpl.js on lines 7527..7543
                          dist/tmpl.js on lines 352..368

                          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 174.

                          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 3 locations. Consider refactoring.
                          Open

                            function _tmpl (str, data) {
                              if (!str) return str
                          
                              return (_cache[str] || (_cache[str] = _create(str))).call(
                                data, _logErr.bind({
                          Severity: Major
                          Found in dist/es6.tmpl.js and 2 other locations - About 1 hr to fix
                          dist/csp.tmpl.js on lines 7507..7516
                          dist/tmpl.js on lines 332..341

                          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 70.

                          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

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

                            function _create (str) {
                              var expr = _getTmpl(str)
                          
                              if (expr.slice(0, 11) !== 'try{return ') expr = 'return ' + expr
                          
                          
                          Severity: Major
                          Found in dist/es6.tmpl.js and 1 other location - About 1 hr to fix
                          dist/tmpl.js on lines 370..376

                          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 62.

                          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

                          There are no issues that match your filters.

                          Category
                          Status