Showing 503 of 787 total issues
Function run
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async run(sql, parameters) {
this.sql = sql;
const { connection, options } = this;
//do we need benchmark for this query execution
- 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 _collectModels
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_collectModels(include, prefix) {
const ret = {};
if (include) {
for (const _include of include) {
- 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 getConnection
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async getConnection(options) {
options = options || {};
options.uuid = options.uuid || 'default';
options.storage = this.sequelize.options.storage || this.sequelize.options.host || ':memory:';
options.inMemory = options.storage === ':memory:' ? 1 : 0;
- 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 destroy
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static async destroy(options) {
options = Utils.cloneDeep(options);
this._injectScope(options);
- 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 _findAutoIncrementAttribute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static _findAutoIncrementAttribute() {
this.autoIncrementAttribute = null;
for (const name in this.rawAttributes) {
if (Object.prototype.hasOwnProperty.call(this.rawAttributes, name)) {
- 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 _mergeFunction
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
static _mergeFunction(objValue, srcValue, key) {
if (Array.isArray(objValue) && Array.isArray(srcValue)) {
return _.union(objValue, srcValue);
}
if (key === 'where' || key === 'having') {
- 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 constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(source, target, options) {
super(source, target, options);
this.associationType = 'BelongsTo';
this.isSingleAssociation = true;
- 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 constructor
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
constructor(source, target, options) {
super(source, target, options);
this.associationType = 'HasOne';
this.isSingleAssociation = true;
- 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 mapWhereFieldNames
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapWhereFieldNames(attributes, Model) {
if (attributes) {
getComplexKeys(attributes).forEach(attribute => {
const rawAttribute = Model.rawAttributes[attribute];
Function prepareEnvironment
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async prepareEnvironment(useCLS) {
let connectionPromise;
if (useCLS === undefined) {
useCLS = true;
Function getConnection
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getConnection(options) {
options = options || {};
options.uuid = options.uuid || 'default';
options.storage = this.sequelize.options.storage || this.sequelize.options.host || ':memory:';
options.inMemory = options.storage === ':memory:' ? 1 : 0;
Function query
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
const query = new Promise((resolve, reject) => {
// TRANSACTION SUPPORT
if (sql.startsWith('BEGIN TRANSACTION')) {
return connection.beginTransaction(
error => (error ? reject(error) : resolve([])),
Function generateReturnValues
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateReturnValues(modelAttributes, options) {
const returnFields = [];
const returnTypes = [];
let outputFragment = '';
let returningFragment = '';
Function run
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(sql, parameters) {
this.sql = sql;
const { connection, options } = this;
//do we need benchmark for this query execution
Function _setInclude
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
_setInclude(key, value, options) {
if (!Array.isArray(value)) value = [value];
if (value[0] instanceof Model) {
value = value.map(instance => instance.dataValues);
}
Function upsert
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async upsert(tableName, insertValues, updateValues, where, options) {
options = { ...options };
const model = options.model;
const primaryKeys = Object.values(model.primaryKeys).map(item => item.field);
Function describeTable
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async describeTable(tableName, options) {
let schema = null;
let schemaDelimiter = null;
if (typeof options === 'string') {
Function _paranoidClause
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _paranoidClause(model, options = {}) {
// Apply on each include
// This should be handled before handling where conditions because of logic with returns
// otherwise this code will never run on includes of a already conditionable where
if (options.include) {
Function runHooks
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async runHooks(hooks, ...hookArgs) {
if (!hooks) throw new Error('runHooks requires at least 1 argument');
let hookType;
Function removeConstraint
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
async removeConstraint(tableName, constraintName, options) {
let createTableSql;
const constraints = await this.showConstraint(tableName, constraintName);
// sqlite can't show only one constraint, so we find here the one to remove