Showing 503 of 787 total issues
Function escape
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export function escape(val: unknown, timeZone: string | null, dialect: string, format = false): string {
let prependN = false;
if (val === undefined || val === null) {
return '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 formatError
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
formatError(err) {
let match;
let table;
let index;
let fields;
Function generateJoin
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
generateJoin(include, topLevelInfo) {
const association = include.association;
const parent = include.parent;
const parentIsTop =
!!parent && !include.parent.association && include.parent.model.name === topLevelInfo.options.model.name;
Function initPools
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
initPools() {
const config = this.config;
if (!config.replication) {
this.pool = new Pool({
Function handleInsertQuery
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
handleInsertQuery(results, metaData) {
if (this.instance) {
// add the inserted row id to the instance
const autoIncrementAttribute = this.model.autoIncrementAttribute;
let id = 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 updateQuery
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
updateQuery(tableName, attrValueHash, where, options, attributes) {
options = options || {};
_.defaults(options, this.options);
attrValueHash = Utils.removeNullValuesFromHash(attrValueHash, options.omitNull, 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 getConnection
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
async getConnection(options) {
options = options || {};
if (this.sequelize.options.databaseVersion === 0) {
if (!this.versionPromise) {
- 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 scope
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
static scope(option) {
const self = class extends this {};
let scope;
let scopeName;
- 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 set
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
async set(sourceInstance, newAssociatedObjects, options) {
options = options || {};
const sourceKey = this.sourceKey;
const targetKey = this.targetKey;
Function upsertQuery
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
upsertQuery(tableName, insertValues, updateValues, where, model) {
const targetTableAlias = this.quoteTable(`${tableName}_target`);
const sourceTableAlias = this.quoteTable(`${tableName}_source`);
const primaryKeysAttrs = [];
const identityAttrs = [];
Function findOrCreate
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async findOrCreate(options) {
if (!options || !options.where || arguments.length > 1) {
throw new Error(
'Missing where attribute in the options parameter passed to findOrCreate. ' +
'Please note that the API has changed, and is now options only (an object with where, defaults keys, transaction etc.)'
Function addIndexQuery
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
addIndexQuery(tableName, attributes, options, rawTablename) {
options = options || {};
if (!Array.isArray(attributes)) {
options = attributes;
Function handleSequelizeMethod
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSequelizeMethod(smth, tableName, factory, options, prepend) {
let result;
if (Object.prototype.hasOwnProperty.call(this.OperatorMap, smth.comparator)) {
smth.comparator = this.OperatorMap[smth.comparator];
Function exports
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://dev.mysql.com/doc/refman/5.7/en/data-types.html';
/**
* types: [buffer_type, ...]
- 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 set
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
async set(sourceInstance, newAssociatedObjects, options) {
options = options || {};
const sourceKey = this.sourceKey;
const targetKey = this.targetKey;
- 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 _injectAttributes
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
_injectAttributes() {
this.identifier = this.foreignKey;
this.foreignIdentifier = this.otherKey;
// remove any PKs previously defined by sequelize
- 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 sync
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async sync(options) {
options = { ...this.options, ...options };
options.hooks = options.hooks === undefined ? true : !!options.hooks;
const attributes = this.tableAttributes;
Function _expandIncludeAllElement
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _expandIncludeAllElement(includes, include) {
// check 'all' attribute provided is valid
let all = include.all;
delete include.all;
Function add
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
async add(sourceInstance, newInstances, options) {
// If newInstances is null or undefined, no-op
if (!newInstances) return Promise.resolve();
options = { ...options };
Function attributeToSQL
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
attributeToSQL(attribute) {
if (!_.isPlainObject(attribute)) {
attribute = {
type: attribute
};
- 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"