unsplit/unsplit

View on GitHub
src/plugins/mustache.js

Summary

Maintainability
F
6 days
Test Coverage

Function mustacheFactory has a Cognitive Complexity of 170 (exceeds 5 allowed). Consider refactoring.
Open

}(this, function mustacheFactory (mustache) {

  var objectToString = Object.prototype.toString;
  var isArray = Array.isArray || function isArrayPolyfill (object) {
    return objectToString.call(object) === '[object Array]';
Severity: Minor
Found in src/plugins/mustache.js - About 3 days 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 mustacheFactory has 349 lines of code (exceeds 25 allowed). Consider refactoring.
Open

}(this, function mustacheFactory (mustache) {

  var objectToString = Object.prototype.toString;
  var isArray = Array.isArray || function isArrayPolyfill (object) {
    return objectToString.call(object) === '[object Array]';
Severity: Major
Found in src/plugins/mustache.js - About 1 day to fix

    File mustache.js has 360 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * mustache.js - Logic-less {{mustache}} templates with JavaScript
     * http://github.com/janl/mustache.js
     */
    
    
    Severity: Minor
    Found in src/plugins/mustache.js - About 4 hrs to fix

      Function parseTemplate has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function parseTemplate (template, tags) {
          if (!template)
            return [];
      
          var sections = [];     // Stack to hold section tokens
      Severity: Major
      Found in src/plugins/mustache.js - About 3 hrs to fix

        Function lookup has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          Context.prototype.lookup = function lookup (name) {
            var cache = this.cache;
        
            var value;
            if (name in cache) {
        Severity: Minor
        Found in src/plugins/mustache.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                      if (index === names.length - 1 && value != null)
                        lookupHit = (typeof value === 'object') &&
                          value.hasOwnProperty(names[index]);
          Severity: Major
          Found in src/plugins/mustache.js - About 45 mins to fix

            There are no issues that match your filters.

            Category
            Status