socketstream/socketstream

View on GitHub
lib/client/template_engine.js

Summary

Maintainability
D
1 day
Test Coverage

Function exports has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(ss,options) {
  var mods = [];

  // Set the Default Engine - simply wraps each template in a <script> tag
  var defaultEngine = require('./template_engines/default')(ss.root,null,options);
Severity: Minor
Found in lib/client/template_engine.js - About 5 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 exports has 123 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(ss,options) {
  var mods = [];

  // Set the Default Engine - simply wraps each template in a <script> tag
  var defaultEngine = require('./template_engines/default')(ss.root,null,options);
Severity: Major
Found in lib/client/template_engine.js - About 4 hrs to fix

    Function use has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        use: function(nameOrModule, dirs, config) {
          if (!dirs) {
            dirs = ['.'];
          }
          if (!(dirs instanceof Array)) {
    Severity: Minor
    Found in lib/client/template_engine.js - About 1 hr to fix

      Function generate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          generate: function(bundler, files, cb) {
            var prevEngine = null;
            var templates = [];
            if (!(files && files.length > 0)) {
              cb('');
      Severity: Minor
      Found in lib/client/template_engine.js - About 1 hr to fix

        Function wrapTemplate has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          function wrapTemplate(template, pth, logicPath, opts, options, engine, prevEngine) {
        Severity: Major
        Found in lib/client/template_engine.js - About 50 mins to fix

          There are no issues that match your filters.

          Category
          Status