Showing 503 of 787 total issues
File model.js
has 2942 lines of code (exceeds 250 allowed). Consider refactoring. Open
const assert = require('assert');
const _ = require('lodash');
const Dottie = require('dottie');
const Utils = require('./utils');
File query-generator.js
has 2297 lines of code (exceeds 250 allowed). Consider refactoring. Open
const util = require('util');
const _ = require('lodash');
const uuidv4 = require('uuid').v4;
const Utils = require('../../utils');
Function _groupJoinData
has a Cognitive Complexity of 251 (exceeds 5 allowed). Consider refactoring. Open
static _groupJoinData(rows, includeOptions, options) {
/*
* Assumptions
* ID is not necessarily the first field
* All fields for a level is grouped in the same set (i.e. Panel.id, Task.id, Panel.title is not possible)
- Read upRead up
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 144 (exceeds 5 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'http://www.postgresql.org/docs/9.4/static/datatype.html');
/**
* Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
- Read upRead up
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 run
has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring. Open
async run(sql, parameters) {
const { connection } = this;
if (!_.isEmpty(this.options.searchPath)) {
sql = this.sequelize.getQueryInterface().queryGenerator.setSearchPath(this.options.searchPath) + sql;
- Read upRead up
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 441 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'http://www.postgresql.org/docs/9.4/static/datatype.html');
/**
* Removes unsupported Postgres options, i.e., LENGTH, UNSIGNED and ZEROFILL, for the integer data types.
Function selectQuery
has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring. Open
selectQuery(tableName, options, model) {
options = options || {};
const limit = options.limit;
const mainQueryItems = [];
const subQueryItems = [];
- Read upRead up
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 query-generator.js
has 780 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const Utils = require('../../utils');
const DataTypes = require('../../data-types');
const TableHints = require('../../table-hints');
const AbstractQueryGenerator = require('../abstract/query-generator');
Model
has 93 functions (exceeds 20 allowed). Consider refactoring. Open
class Model {
static get queryInterface() {
return this.sequelize.getQueryInterface();
}
File query-generator.js
has 738 lines of code (exceeds 250 allowed). Consider refactoring. Open
const Utils = require('../../utils');
const util = require('util');
const DataTypes = require('../../data-types');
const AbstractQueryGenerator = require('../abstract/query-generator');
const semver = require('semver');
Function set
has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring. Open
set(key, value, options) {
let values;
let originalValue;
if (typeof key === 'object' && key !== null) {
- Read upRead up
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 generateInclude
has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring. Open
generateInclude(include, parentTableName, topLevelInfo) {
const joinQueries = {
mainQuery: [],
subQuery: []
};
- Read upRead up
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 bulkCreate
has 305 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async bulkCreate(records, options = {}) {
if (!records.length) {
return [];
}
Function recursiveBulkCreate
has 288 lines of code (exceeds 25 allowed). Consider refactoring. Open
const recursiveBulkCreate = async (instances, options) => {
options = {
validate: false,
hooks: true,
individualHooks: false,
File data-types.js
has 646 lines of code (exceeds 250 allowed). Consider refactoring. Open
const util = require('util');
const _ = require('lodash');
const wkx = require('wkx');
const sequelizeErrors = require('./errors');
const Validator = require('./utils/validator-extras').validator;
Function selectQuery
has 282 lines of code (exceeds 25 allowed). Consider refactoring. Open
selectQuery(tableName, options, model) {
options = options || {};
const limit = options.limit;
const mainQueryItems = [];
const subQueryItems = [];
File query-interface.js
has 624 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const Utils = require('../../utils');
const DataTypes = require('../../data-types');
const Transaction = require('../../transaction');
Function _groupJoinData
has 265 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _groupJoinData(rows, includeOptions, options) {
/*
* Assumptions
* ID is not necessarily the first field
* All fields for a level is grouped in the same set (i.e. Panel.id, Task.id, Panel.title is not possible)
File belongs-to-many.js
has 594 lines of code (exceeds 250 allowed). Consider refactoring. Open
const Utils = require('./../utils');
const Helpers = require('./helpers');
const _ = require('lodash');
const Association = require('./base');
const BelongsTo = require('./belongs-to');
Function save
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
async save(options) {
if (arguments.length > 1) {
throw new Error('The second argument was removed in favor of the options object.');
}
- Read upRead up
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"