csballz/koala-puree

View on GitHub

Showing 580 of 580 total issues

Function pureecontrollers has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

exports = module.exports = function pureecontrollers(){

    return {
        setup: function* (next) {
            debug("beginning controller middleware setup");
Severity: Minor
Found in lib/controllers.js - About 1 day 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 models.js has 521 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This module creates a wrapper around the orientose orm
 *
 * @module lib/models
 * @link OrientoseModelPlugin
Severity: Major
Found in lib/models.js - About 1 day to fix

    Function OrientoseModelPlugin has 199 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function OrientoseModelPlugin() {
        /**
         * @class OrientoseModelPlugin
         */
        var obj = {
    Severity: Major
    Found in lib/models.js - About 7 hrs to fix

      Function buildschema has 173 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          buildschema(parent) {
              var self = this;
              parent = parent || Schema.V;
              var schema = new parent(self._props, {
                  className: this._name
      Severity: Major
      Found in lib/models.js - About 6 hrs to fix

        Function pureecontrollers has 164 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports = module.exports = function pureecontrollers(){
        
            return {
                setup: function* (next) {
                    debug("beginning controller middleware setup");
        Severity: Major
        Found in lib/controllers.js - About 6 hrs to fix

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

                  setup: function* (next) {
                      debug("beginning controller middleware setup");
                      var app = this;
                      function* overrideMethodMiddleware(next){
                          var body, parts;
          Severity: Major
          Found in lib/controllers.js - About 6 hrs to fix

            Function constructor has 123 lines of code (exceeds 25 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: Major
            Found in index.js - About 4 hrs to fix

              Function decorate has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
              Open

              function decorate(req){
              
                  /**
                   * Intiate a login session for `user`.
                   *
              Severity: Minor
              Found in lib/passport-req.js - About 4 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 106 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports = module.exports = function(){
                  return {
                      setup: function *setupSIO(next) {
                          const puree = this;
                          const koaApp = puree.app;
              Severity: Major
              Found in lib/sio.js - About 4 hrs to fix

                Function OrientoseModelPlugin has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function OrientoseModelPlugin() {
                    /**
                     * @class OrientoseModelPlugin
                     */
                    var obj = {
                Severity: Minor
                Found in lib/models.js - About 4 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 2 locations. Consider refactoring.
                Open

                    describe('making service calls', function(){
                        it("should be able call /test", function(done){
                            this.timeout(5000);
                            puree.services('koala-puree-test').get('/test').then(function(res){
                                expect(res.status).eql(200);
                Severity: Major
                Found in testApp/test/infra.js and 1 other location - About 4 hrs to fix
                testApp/test/infra.js on lines 41..50

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

                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

                        program.command("migrate:rollback")
                        .description("rollback")
                        .action(function(){
                                console.log(arguments);
                                var pureeorm = require("../lib/models.js")();
                Severity: Major
                Found in bin/koala-puree.js and 1 other location - About 4 hrs to fix
                bin/koala-puree.js on lines 85..96

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

                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

                        program.command("migrate")
                        .description("migrates data")
                        .action(function(){
                                console.log(arguments);
                                var pureeorm = require("../lib/models.js")();
                Severity: Major
                Found in bin/koala-puree.js and 1 other location - About 4 hrs to fix
                bin/koala-puree.js on lines 97..108

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

                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

                    describe('making service calls twice using same service', function(){
                        it("should be able call /test", function(done){
                            this.timeout(5000);
                            puree.services('koala-puree-test').get('/test').then(function(res){
                                expect(res.status).eql(200);
                Severity: Major
                Found in testApp/test/infra.js and 1 other location - About 4 hrs to fix
                testApp/test/infra.js on lines 31..40

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

                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

                ModelBuilder.prototype.embedded = function(name, fn) {
                    this._later = this._later || [];
                    this._later.push(function(schemas) {
                        if (require("util").isFunction(fn)) {
                            this.attr(name, fn(schemas));
                Severity: Major
                Found in lib/models.js and 1 other location - About 3 hrs to fix
                lib/models.js on lines 297..306

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

                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

                ModelBuilder.prototype.embeddedlist = function(name, fn) {
                    this._later = this._later || [];
                    this._later.push(function(schemas) {
                        if (require("util").isFunction(fn)) {
                            this.attr(name, fn(schemas));
                Severity: Major
                Found in lib/models.js and 1 other location - About 3 hrs to fix
                lib/models.js on lines 308..317

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

                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 setupSIO has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        setup: function *setupSIO(next) {
                            const puree = this;
                            const koaApp = puree.app;
                            var nsp = puree.ns || "/";
                            function handler(origHeaders) {
                Severity: Major
                Found in lib/sio.js - About 3 hrs to fix

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

                  exports = module.exports = function(){
                      return {
                          setup: function *setupSIO(next) {
                              const puree = this;
                              const koaApp = puree.app;
                  Severity: Minor
                  Found in lib/sio.js - About 3 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 setupModel has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          setup: function * setupModel(next) {
                  
                              var app = this;
                              debug(`beginning model middleware`);
                              var dburl;
                  Severity: Major
                  Found in lib/models.js - About 3 hrs to fix

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language