Showing 503 of 787 total issues
File sequelize.js
has 580 lines of code (exceeds 250 allowed). Consider refactoring. Open
const url = require('url');
const path = require('path');
const retry = require('retry-as-promised');
const _ = require('lodash');
Function sync
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
static async sync(options) {
options = { ...this.options, ...options };
options.hooks = options.hooks === undefined ? true : !!options.hooks;
const attributes = this.tableAttributes;
- 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 save
has 228 lines of code (exceeds 25 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.');
}
Function bulkCreate
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
static async bulkCreate(records, options = {}) {
if (!records.length) {
return [];
}
- 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.js
has 534 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const SqlString = require('../../sql-string');
const QueryTypes = require('../../query-types');
const Dot = require('dottie');
const deprecations = require('../../utils/deprecations');
Function run
has 218 lines of code (exceeds 25 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;
QueryGenerator
has 60 functions (exceeds 20 allowed). Consider refactoring. Open
class QueryGenerator {
constructor(options) {
if (!options.sequelize) throw new Error('QueryGenerator initialized without options.sequelize');
if (!options._dialect) throw new Error('QueryGenerator initialized without options._dialect');
Function ensureEnums
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
async ensureEnums(tableName, attributes, options, model) {
const keys = Object.keys(attributes);
const keyLen = keys.length;
let 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
PostgresQueryGenerator
has 55 functions (exceeds 20 allowed). Consider refactoring. Open
class PostgresQueryGenerator extends AbstractQueryGenerator {
setSearchPath(searchPath) {
return `SET search_path to ${searchPath};`;
}
Function insertQuery
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
insertQuery(table, valueHash, modelAttributes, options) {
options = options || {};
_.defaults(options, this.options);
const modelAttributeMap = {};
- 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 _expandIncludeAllElement
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
static _expandIncludeAllElement(includes, include) {
// check 'all' attribute provided is valid
let all = include.all;
delete include.all;
- 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 48 (exceeds 5 allowed). Consider refactoring. Open
constructor(database, username, password, options) {
let config;
if (arguments.length === 1 && typeof database === 'object') {
// new Sequelize({ ... 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 whereItemQuery
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
whereItemQuery(key, value, options = {}) {
if (value === undefined) {
throw new Error(`WHERE parameter "${key}" has invalid "undefined" value`);
}
- 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
QueryInterface
has 52 functions (exceeds 20 allowed). Consider refactoring. Open
class QueryInterface {
constructor(sequelize, queryGenerator) {
this.sequelize = sequelize;
this.queryGenerator = queryGenerator;
}
Function _handleQueryResponse
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
_handleQueryResponse(metaData, columnTypes, err, results) {
if (err) {
err.sql = this.sql;
throw this.formatError(err);
}
- 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 179 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
const warn = BaseTypes.ABSTRACT.warn.bind(
undefined,
'https://msdn.microsoft.com/en-us/library/ms187752%28v=sql.110%29.aspx'
);
Function handleSequelizeMethod
has a Cognitive Complexity of 46 (exceeds 5 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];
- 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 175 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
const warn = BaseTypes.ABSTRACT.warn.bind(undefined, 'https://www.sqlite.org/datatype3.html');
/**
* Removes unsupported SQLite options, i.e., UNSIGNED and ZEROFILL, for the integer data types.
Function attributeToSQL
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
attributeToSQL(attribute, options) {
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
File query-generator.js
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
const _ = require('lodash');
const Utils = require('../../utils');
const AbstractQueryGenerator = require('../abstract/query-generator');
const util = require('util');
const Op = require('../../operators');