getlackey/lackey-cms

View on GitHub
modules/core/server/models/objection/index.js

Summary

Maintainability
F
1 wk
Test Coverage

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

    .then((knex) => {
        return knex
            .schema
            .dropTableIfExists('objection')
            .then(() => {
Severity: Major
Found in modules/core/server/models/objection/index.js - About 3 days to fix

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

        .then((knex) => {
            return knex
                .schema
                .dropTableIfExists('objection')
                .then(() => {
    Severity: Minor
    Found in modules/core/server/models/objection/index.js - About 2 days 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 636 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint no-underscore-dangle:0 */
    /* jslint node:true, esnext:true */
    /* globals LACKEY_PATH */
    'use strict';
    
    
    Severity: Major
    Found in modules/core/server/models/objection/index.js - About 1 day to fix

      Function table has 187 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                          static table(inputQuery, inputColumns, options) {
                              SCli.debug(__MODULE_NAME, 'table', this.model.tableName, JSON.stringify(inputQuery), JSON.stringify(inputColumns), JSON.stringify(options));
                              let
                                  query,
                                  columns = inputColumns,
      Severity: Major
      Found in modules/core/server/models/objection/index.js - About 7 hrs to fix

        Function where has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                            static where(cursor, query, operand) {
                                SCli.debug(__MODULE_NAME, 'where', this.model.tableName, JSON.stringify(query), operand);
        
                                let self = this,
                                    fn = operand === 'or' ? 'orWhere' : 'where',
        Severity: Minor
        Found in modules/core/server/models/objection/index.js - About 1 hr to fix

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

                              save(options) {
                                  SCli.debug(__MODULE_NAME, 'save', this.constructor.model.tableName);
                                  let self = this,
                                      hook = new Error(),
                                      cached = _.cloneDeep(this._doc);
          Severity: Minor
          Found in modules/core/server/models/objection/index.js - About 1 hr to fix

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

                                static query(query, populate, options) {
                                    let self = this;
                                    SCli.debug(__MODULE_NAME, 'query', this.model.tableName);
                                    if (!self.model) {
                                        return Promise.reject('This model doesn\'t supply mongo model reference for shared methods');
            Severity: Minor
            Found in modules/core/server/models/objection/index.js - About 1 hr to fix

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

                                  static _preQuery(query, options) {
                                      let amendedQuery = JSON.parse(JSON.stringify(query || {}));
              
                                      if (this.likeables && options && options.textSearch) {
              
              
              Severity: Minor
              Found in modules/core/server/models/objection/index.js - About 1 hr to fix

                Avoid too many return statements within this function.
                Open

                                        return value;
                Severity: Major
                Found in modules/core/server/models/objection/index.js - About 30 mins to fix

                  There are no issues that match your filters.

                  Category
                  Status