dist/tmpl.js

Summary

Maintainability
F
3 wks
Test Coverage

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/tmpl.js - About 6 hrs to fix

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

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

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

      
      /* riot-tmpl v3.0.8, @license MIT, (c) 2015 Muut Inc. + contributors */
      ;(function (window) {     // eslint-disable-line no-extra-semi
        'use strict'
      
      
      Severity: Minor
      Found in dist/tmpl.js - About 5 hrs to fix

        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/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/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/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/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/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/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/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/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/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/tmpl.js and 2 other locations - About 1 wk to fix
                          dist/csp.tmpl.js on lines 7268..7493
                          dist/es6.tmpl.js on lines 97..322

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

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

                          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/tmpl.js and 2 other locations - About 1 day to fix
                          dist/csp.tmpl.js on lines 7556..7598
                          dist/es6.tmpl.js on lines 386..428

                          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/tmpl.js and 2 other locations - About 1 day to fix
                          dist/csp.tmpl.js on lines 7666..7701
                          dist/es6.tmpl.js on lines 496..531

                          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/tmpl.js and 2 other locations - About 6 hrs to fix
                          dist/csp.tmpl.js on lines 7527..7543
                          dist/es6.tmpl.js on lines 357..373

                          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

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

                            if (typeof module === 'object' && module.exports) {
                              module.exports = {
                                tmpl: tmpl, brackets: brackets
                              }
                            } else if (typeof define === 'function' && typeof define.amd !== 'undefined') {
                          Severity: Major
                          Found in dist/tmpl.js and 1 other location - About 2 hrs to fix
                          src/index.js on lines 34..47

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

                          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/tmpl.js and 2 other locations - About 1 hr to fix
                          dist/csp.tmpl.js on lines 7507..7516
                          dist/es6.tmpl.js on lines 337..346

                          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/tmpl.js and 1 other location - About 1 hr to fix
                          dist/es6.tmpl.js on lines 375..381

                          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