Showing 503 of 787 total issues
Function changeColumnQuery
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
changeColumnQuery(tableName, attributes) {
const query = subQuery => `ALTER TABLE ${this.quoteTable(tableName)} ALTER COLUMN ${subQuery};`;
const sql = [];
for (const attributeName in attributes) {
let definition = this.dataTypeMapping(tableName, attributeName, attributes[attributeName]);
- 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 quoteTable
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
quoteTable(param, alias) {
let table = '';
if (alias === true) {
alias = param.as || param.name || param;
- 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 aggregate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
static async aggregate(attribute, aggregateFunction, options) {
options = Utils.cloneDeep(options);
// We need to preserve attributes here as the `injectScope` call would inject non aggregate columns.
const prevAttributes = options.attributes;
- 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 get
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async get(instance, options) {
options = Utils.cloneDeep(options) || {};
const through = this.through;
let scopeWhere;
- 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 attributesToSQL
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
attributesToSQL(attributes) {
const result = {};
for (const name in attributes) {
const dataType = attributes[name];
const fieldName = dataType.field || name;
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(source, target, options) {
super(source, target, options);
this.associationType = 'HasOne';
this.isSingleAssociation = true;
Function constructor
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(source, target, options) {
super(source, target, options);
this.associationType = 'BelongsTo';
this.isSingleAssociation = true;
Function _checkValidJsonStatement
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
_checkValidJsonStatement(stmt) {
if (typeof stmt !== 'string') {
return false;
}
Function aggregate
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async aggregate(attribute, aggregateFunction, options) {
options = Utils.cloneDeep(options);
// We need to preserve attributes here as the `injectScope` call would inject non aggregate columns.
const prevAttributes = options.attributes;
Function get
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async get(instance, options) {
options = Utils.cloneDeep(options) || {};
const through = this.through;
let scopeWhere;
Function get
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
async get(instances, options) {
const where = {};
let Target = this.target;
let instance;
Function escapeAttributes
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
escapeAttributes(attributes, options, mainTableAs) {
return (
attributes &&
attributes.map(attr => {
let addTable = true;
Function get
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async get(instances, options) {
const where = {};
let Target = this.target;
let instance;
Function _refreshDynamicOIDs
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _refreshDynamicOIDs(connection) {
const databaseVersion = this.sequelize.options.databaseVersion;
const supportedVersion = '8.3.0';
// Check for supported version
Function changeColumnQuery
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
changeColumnQuery(tableName, attributes) {
const query = subQuery => `ALTER TABLE ${this.quoteTable(tableName)} ALTER COLUMN ${subQuery};`;
const sql = [];
for (const attributeName in attributes) {
let definition = this.dataTypeMapping(tableName, attributeName, attributes[attributeName]);
Function addLimitAndOffset
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
addLimitAndOffset(options, model) {
// Skip handling of limit and offset as postfixes for older SQL Server versions
if (
semver.valid(this.sequelize.options.databaseVersion) &&
semver.lt(this.sequelize.options.databaseVersion, '11.0.0')
Function getConnection
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getConnection(options) {
options = options || {};
if (this.sequelize.options.databaseVersion === 0) {
if (!this.versionPromise) {
Function normalizeAttribute
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
normalizeAttribute(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"
Further reading
Function logWarnings
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async logWarnings(results) {
const warningResults = await this.run('SHOW WARNINGS');
const warningMessage = `MariaDB Warnings (${this.connection.uuid || 'default'}): `;
const messages = [];
for (const _warningRow of warningResults) {
- 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 escape
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
escape(value, field, options) {
options = options || {};
if (value !== null && value !== undefined) {
if (value instanceof Utils.SequelizeMethod) {
- 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"