csballz/koala-puree

View on GitHub

Showing 580 of 580 total issues

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

    it("should get a test.js", function(done){
        this.timeout(5000);
        chai.request("http://localhost:5000")
            .get("/static/test.js")
            .end(function(err, res){
Severity: Major
Found in testApp/test/static.js and 1 other location - About 3 hrs to fix
testApp/test/static.js on lines 40..49

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

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

Function start has 78 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  start(app, forConsole) {
      var self = this;
      self._forConsole = forConsole;

      return new Promise(function(resolve, reject){
Severity: Major
Found in index.js - About 3 hrs to fix

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

        it('should have a get(/test)', function(done){
    
            chai.request("http://localhost:5000")
                .get("/test")
                .end(function(err, res){
    Severity: Major
    Found in testApp/test/routes.js and 1 other location - About 2 hrs to fix
    testApp/test/routes.js on lines 63..71

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

    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

        it('should have a get(/test/:name)', function(done){
            chai.request("http://localhost:5000")
                .get("/test/felix")
                .end(function(err, res){
                    if ( err ) { return done(err); }
    Severity: Major
    Found in testApp/test/routes.js and 1 other location - About 2 hrs to fix
    testApp/test/routes.js on lines 40..49

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

    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

    Function buildschema has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        buildschema(parent) {
            var self = this;
            parent = parent || Schema.V;
            var schema = new parent(self._props, {
                className: this._name
    Severity: Minor
    Found in lib/models.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

    File index.js has 276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    "use strict";
    require("any-promise/register")("bluebird");
    var readYaml = require("read-yaml"), extend = require("extend");
    
    var debug = require("debug")("koala-puree");
    Severity: Minor
    Found in index.js - About 2 hrs to fix

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

      exports = module.exports = function(){
          function advertise(self) {
              if ( self._ad ) { self._ad.stop(); }
              debug("Starting mdns middleware");
              debug(self._config);
      Severity: Minor
      Found in lib/mdns.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 request has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          request: function(method, path, data, headers) {
              debug(`calling general request helper: start`);
              var self = this;
              function _request(sc, path, nsp, method, data, headers, resolve, reject) {
                  var realPath = "";
      Severity: Major
      Found in lib/service.js - About 2 hrs to fix

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

        exports = module.exports = function(){
            function advertise(self) {
                if ( self._ad ) { self._ad.stop(); }
                debug("Starting mdns middleware");
                debug(self._config);
        Severity: Major
        Found in lib/mdns.js - About 2 hrs to fix

          Function overrideMethodMiddleware has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      function* overrideMethodMiddleware(next){
                          var body, parts;
                          debug("body middleware", this.req.url);
                  // only parse if it is form, cause if not, this is not a problem
                          if ( /application\/x-www-form-urlencoded/.test(this.req.headers["content-type"])) {
          Severity: Major
          Found in lib/controllers.js - About 2 hrs to fix

            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

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

                                              "limit where order let".split(" ").forEach(function(name){
                                                  newQuery[name] = function(){
                                                      debug(this.query);
                                                      this.query[name].apply(this.query, arguments);
                                                      return this;
              Severity: Major
              Found in lib/models.js and 1 other location - About 2 hrs to fix
              lib/models.js on lines 178..184

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

              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

                                              "limit where order let".split(" ").forEach(function(name){
                                                  newQuery[name] = function(){
                                                      debug(this.query);
                                                      this.query[name].apply(this.query, arguments);
                                                      return this;
              Severity: Major
              Found in lib/models.js and 1 other location - About 2 hrs to fix
              lib/models.js on lines 140..146

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

              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

              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

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

                    it('websocket: should have a get(/test/:name)', function(done){
                        sio.emit('s', "get", "/test/felix", {},{}, function(status, headers, body){
                            expect(status).eql(200);
                            expect(body).eql('felix')
                            done();
                Severity: Major
                Found in testApp/test/routes.js and 2 other locations - About 2 hrs to fix
                testApp/test/routes.js on lines 72..78
                testApp/test/routes.js on lines 105..111

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

                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

                    it('websocket: should have a get(/test)', function(done){
                        sio.emit('s', "get", "/test", {},{}, function(status, headers, body){
                            expect(status).eql(200);
                            expect(body).eql('get')
                            done();
                Severity: Major
                Found in testApp/test/routes.js and 2 other locations - About 2 hrs to fix
                testApp/test/routes.js on lines 86..92
                testApp/test/routes.js on lines 105..111

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

                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

                    it('promises/websocket: should have a get(/promises/test)', function(done){
                        sio.emit('s', "get", "/promises/test", {},{}, function(status, headers, body){
                            expect(status).eql(200);
                            expect(body).eql('get')
                            done();
                Severity: Major
                Found in testApp/test/routes.js and 2 other locations - About 2 hrs to fix
                testApp/test/routes.js on lines 72..78
                testApp/test/routes.js on lines 86..92

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

                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

                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
                    Severity
                    Category
                    Status
                    Source
                    Language