alekzonder/maf

View on GitHub

Showing 90 of 90 total issues

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

    sort (sort) {
        if (sort) {
            if (this._debugTimer) {
                this._debugTimer.sort = sort;
            }
Severity: Major
Found in src/Model/Tingodb/FindCursorChain.js and 3 other locations - About 1 hr to fix
src/Model/Mongodb/FindCursorChain.js on lines 71..81
src/Model/Mongodb/FindCursorChain.js on lines 101..112
src/Model/Tingodb/FindCursorChain.js on lines 89..100

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

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 4 locations. Consider refactoring.
Open

    sort (sort) {
        if (sort) {
            if (this._debugTimer) {
                this._debugTimer.sort = sort;
            }
Severity: Major
Found in src/Model/Mongodb/FindCursorChain.js and 3 other locations - About 1 hr to fix
src/Model/Mongodb/FindCursorChain.js on lines 101..112
src/Model/Tingodb/FindCursorChain.js on lines 59..69
src/Model/Tingodb/FindCursorChain.js on lines 89..100

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

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 4 locations. Consider refactoring.
Open

    skip (skip) {
        if (skip) {

            if (this._debugTimer) {
                this._debugTimer.skip = skip;
Severity: Major
Found in src/Model/Tingodb/FindCursorChain.js and 3 other locations - About 1 hr to fix
src/Model/Mongodb/FindCursorChain.js on lines 71..81
src/Model/Mongodb/FindCursorChain.js on lines 101..112
src/Model/Tingodb/FindCursorChain.js on lines 59..69

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

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 4 locations. Consider refactoring.
Open

    skip (skip) {
        if (skip) {

            if (this._debugTimer) {
                this._debugTimer.skip = skip;
Severity: Major
Found in src/Model/Mongodb/FindCursorChain.js and 3 other locations - About 1 hr to fix
src/Model/Mongodb/FindCursorChain.js on lines 71..81
src/Model/Tingodb/FindCursorChain.js on lines 59..69
src/Model/Tingodb/FindCursorChain.js on lines 89..100

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

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

    insertOne (data/*, options*/) {

        return new Promise((resolve, reject) => {

            var timer = this._createTimer('insertOne');
Severity: Minor
Found in src/Model/Mongodb/index.js - About 1 hr to fix

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

    module.exports = function (di, config) {
    
        var app = express();
    
        app.di = di;
    Severity: Minor
    Found in src/Service/Application.js - About 1 hr to fix

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

          _init () {
              var that = this;
      
              var makeSimpleStep = function (stepName) {
                  return function (value) {
      Severity: Minor
      Found in src/Chain.js - About 1 hr to fix

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

            load () {
                return new Promise((resolve, reject) => {
        
                    getConfigFromConsul(this._logger, this._options)
                        .then((config) => {
        Severity: Minor
        Found in src/Service/Config/index.js - About 1 hr to fix

          Function create has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              create (data, options) {
          
                  return new Promise((resolve, reject) => {
          
                      var timer = this._createTimer(this.entity + ':create');
          Severity: Minor
          Found in src/Api/Abstract.js - About 1 hr to fix

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

            module.exports = function (logger) {
            
                return function (error, req, res, next) {
            
                    if (error) {
            Severity: Minor
            Found in src/express/body-parser/json-error.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 exports has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports = function (logger, di, apiClasses, createFunctions) {
            
            
                var original = {
                    di: di,
            Severity: Minor
            Found in src/Api/createCollection/createProxy.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 insertOne has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                insertOne (data, options) {
            
                    return new Promise((resolve, reject) => {
            
                        var timer = this._createTimer('insertOne');
            Severity: Minor
            Found in src/Model/Tingodb/index.js - About 1 hr to fix

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

                  check (logger) {
              
                      if (this._entity && this._error.entity !== this._entity) {
                          return false;
                      }
              Severity: Minor
              Found in src/Error/CheckChain.js - About 1 hr to fix

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

                        helpers.badRequest = function (error) {
                
                            var message = 'Bad Request';
                            var code = null;
                            var list = [];
                Severity: Minor
                Found in src/express/response/helpers/index.js - About 1 hr to fix

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

                  module.exports = function (init) {
                  
                      return function (logger, config, originalDi) {
                  
                          return new Promise((resolve, reject) => {
                  Severity: Minor
                  Found in src/Service/Init/Di.js - About 1 hr to fix

                    Function findOneAndUpdate has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        findOneAndUpdate (filter, update, options) {
                    
                            var timer = this._createTimer('findOneAndUpdate');
                    
                            if (!options) {
                    Severity: Minor
                    Found in src/Model/Mongodb/index.js - About 1 hr to fix

                      Function ensureIndexes has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ensureIndexes () {
                      
                              return new Promise((resolve, reject) => {
                      
                                  if (!this._indexes) {
                      Severity: Minor
                      Found in src/Model/Tingodb/index.js - About 1 hr to fix

                        Function findOne has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            findOne (filters, fields) {
                        
                                var timer = this._createTimer(this.entity + ':findOne');
                        
                                timer.data = {
                        Severity: Minor
                        Found in src/Api/Abstract.js - About 1 hr to fix

                          Function post has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              post (url, body, options) {
                          
                                  return new Promise((resolve, reject) => {
                          
                                      var timer = this._createTimer('post');
                          Severity: Minor
                          Found in src/Rest/Client/index.js - About 1 hr to fix

                            Function getConsulKey has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var getConsulKey = function (logger, key, options) {
                            
                                return new Promise((resolve, reject) => {
                                    var url = `http://${options.host}:${options.port}/v1/kv/${key}`;
                            
                            
                            Severity: Minor
                            Found in src/Service/Config/getConfigFromConsul.js - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language