csballz/koala-puree

View on GitHub

Showing 50 of 580 total issues

Function exports has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports = module.exports = function(settings){
    var precompile = settings.precompile;
    if ( void 0 === precompile ) {
        precompile = false;
    }
Severity: Major
Found in lib/dust.js - About 2 hrs to fix

    Function handler has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                function handler(origHeaders) {
    
                    delete origHeaders["accept-encoding"];
                    debug("handler with origHeader");
                    return function _handler(method, route, data,headers, cb) {
    Severity: Major
    Found in lib/sio.js - About 2 hrs to fix

      Function Browser has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      var Browser=function(){
        // first search for all possible mdns
        // locate the first dnscache
        // if not located, continue caching everything
        // once located, switch off all browser, and start listening to only dnscache
      Severity: Minor
      Found in lib/service.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 _handler has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      return function _handler(method, route, data,headers, cb) {
                          debug("handler here");
                          debug(`entering into sio handler with (${method}, ${route}, ${data}, ${headers})`);
                          if ( undefined === cb ) { cb = headers; headers = data; }
                          if ( undefined === headers ) { cb = data; }
      Severity: Minor
      Found in lib/sio.js - About 1 hr to fix

        Function decorate has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function decorate(req){
        
            /**
             * Intiate a login session for `user`.
             *
        Severity: Minor
        Found in lib/passport-req.js - About 1 hr to fix

          Function setup has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  setup: function*(next) {
                // precompile all files to .tmp
                      debug("Reaching koala puree dust middleware");
                      var app = this._app;
                      var dust;
          Severity: Minor
          Found in lib/dust.js - About 1 hr to fix

            Function Browser has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var Browser=function(){
              // first search for all possible mdns
              // locate the first dnscache
              // if not located, continue caching everything
              // once located, switch off all browser, and start listening to only dnscache
            Severity: Minor
            Found in lib/service.js - About 1 hr to fix

              Function startServer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        function* startServer(next){
                            debug("starting startServer Mw");
                            require("pmx").init();
                            var server;
                            yield* next;
              Severity: Minor
              Found in index.js - About 1 hr to fix

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

                                            schema.static("findBy"+name, function _reverseLocate(id){
                                                if ( id._id ) {
                                                    id = id._id;
                                                }
                                                var self = this;
                Severity: Minor
                Found in lib/models.js - About 1 hr to fix

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

                                              schema.method(methodName, function _getRelation(){
                                                  var self = this;
                                                  var query = this._orientose()
                                                          ._db
                                                          .select()
                  Severity: Minor
                  Found in lib/models.js - About 1 hr to fix

                    Function middleware has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        middleware: function(){
                            return {
                                setup: function *(next) {
                                    var app = this;
                                    yield (new Promise(function(resolve/*, reject*/){
                    Severity: Minor
                    Found in lib/service.js - About 1 hr to fix

                      Function advertise has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          function advertise(self) {
                              if ( self._ad ) { self._ad.stop(); }
                              debug("Starting mdns middleware");
                              debug(self._config);
                              var adSettings = {
                      Severity: Minor
                      Found in lib/mdns.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (!app._config.db || !app._config.db.url) {
                                        let config = app._config.db || {};
                                        let username = config.username || "root";
                                        let password = config.password || "root";
                                        let host = config.host || "localhost";
                        Severity: Critical
                        Found in lib/models.js - About 1 hr to fix

                          Function get has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              get: function(name, ver) {
                                  var time = new Date();
                              // think of a way to refactor this into a generator, so we can just store that as a cache and yield everytime
                              // hopeful usage would be:
                              // var service = cache[service@version].next();
                          Severity: Minor
                          Found in lib/service.js - About 1 hr to fix

                            Function constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              constructor(mod, config) {
                                  super();
                                  var closestPath = closest.sync(require("path").dirname(mod.filename));
                                  this._basePath = require("path").dirname(closestPath);
                                  var pkginfo = require("@shekhei/pkginfo")(mod);
                            Severity: Minor
                            Found in index.js - About 1 hr 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 listen has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                  app.listen = function listen(port, cb, options) {
                            
                                      if (typeof port === "function") options = cb, cb = port, port = null;
                                      if ( options === undefined && typeof cb !== "function" ) options = cb, cb = undefined;
                                      options = options || {};
                            Severity: Minor
                            Found in index.js - About 1 hr to fix

                              Function seed has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      seed: function(app) {
                                          return new Promise(function(resolve, reject){
                                              glob(require("path").resolve(app._basePath, "db/seed/*.js"), function(er, files) {
                                                  if (er) {
                                                      return reject(er);
                              Severity: Minor
                              Found in lib/models.js - About 1 hr to fix

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

                                            function resolver() {
                                                debug("looping through browser caches");
                                        // keep trying for a specific amount of time, now hard coded, 1s
                                                if ( new Date() - time > 2000 ) { debug("timeout"); return reject(); }
                                                if ( name in globalDnsCache ) {
                                Severity: Minor
                                Found in lib/service.js - About 1 hr to fix

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

                                                  this.req.body = function*(){
                                  
                                                      debug("body generator");
                                                      debug("req.body req headers:",self.req.headers);
                                                      if ( !self.req.headers["content-length"] && !self.req.headers["transfer-encoding"] ) {
                                  Severity: Minor
                                  Found in lib/controllers.js - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                            if ( "link" in rel || "in" in rel || "out" in rel || "both" in rel ) {
                                                                var cond = rel.link || rel.in || rel.out || rel.both;
                                                                var reverseCond;
                                                                if ( "link" !== rel.linkType ) {
                                                                    if ( rel.in ) {
                                    Severity: Major
                                    Found in lib/models.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language