Showing 503 of 787 total issues
Function exports
has a Cognitive Complexity of 30 (exceeds 5 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.
- 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 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
set(key, value, options) {
let values;
let originalValue;
if (typeof key === 'object' && key !== null) {
Function exports
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = BaseTypes => {
BaseTypes.ABSTRACT.prototype.dialectTypes = 'https://mariadb.com/kb/en/library/resultset/#field-types';
/**
* types: [buffer_type, ...]
Function _injectAttributes
has 105 lines of code (exceeds 25 allowed). Consider refactoring. Open
_injectAttributes() {
this.identifier = this.foreignKey;
this.foreignIdentifier = this.otherKey;
// remove any PKs previously defined by sequelize
Function _validateIncludedElement
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _validateIncludedElement(include, tableNames, options) {
tableNames[include.model.getTableName()] = true;
if (include.attributes && !options.raw) {
include.model._expandAttributes(include);
Function exports
has a Cognitive Complexity of 28 (exceeds 5 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'
);
- 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 addLimitAndOffset
has a Cognitive Complexity of 28 (exceeds 5 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')
- 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 ensureEnums
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
async ensureEnums(tableName, attributes, options, model) {
const keys = Object.keys(attributes);
const keyLen = keys.length;
let sql = '';
Function connect
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
async connect(config) {
config.user = config.username;
const connectionConfig = _.pick(config, ['user', 'password', 'host', 'database', 'port']);
connectionConfig.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 connect
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
async connect(config) {
const connectionConfig = {
server: config.host,
authentication: {
type: 'default',
- 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 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
whereItemQuery(key, value, options = {}) {
if (value === undefined) {
throw new Error(`WHERE parameter "${key}" has invalid "undefined" value`);
}
File has-many.js
has 324 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 Op = require('../operators');
Function attributeToSQL
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
attributeToSQL(attribute, options) {
if (!_.isPlainObject(attribute)) {
attribute = {
type: attribute
};
Function connect
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
async connect(config) {
const connectionConfig = {
server: config.host,
authentication: {
type: 'default',
Function query
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
async query(sql, options) {
options = { ...this.options.query, ...options };
if (options.instance && !options.model) {
options.model = options.instance.constructor;
Function _generateSubQueryFilter
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
_generateSubQueryFilter(include, includeAs, topLevelInfo) {
if (!topLevelInfo.subQuery || !include.subQueryFilter) {
return;
}
Function formatError
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
formatError(err) {
switch (err.errno) {
case ER_DUP_ENTRY: {
const match = err.message.match(/Duplicate entry '([\s\S]*)' for key '?((.|\s)*?)'?\s.*$/);
- 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 getWhereConditions
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
getWhereConditions(smth, tableName, factory, options, prepend) {
const where = {};
if (Array.isArray(tableName)) {
tableName = tableName[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 formatError
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
formatError(err) {
const errCode = err.errno || err.code;
switch (errCode) {
case 1062: {
- 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 findOrCreate
has a Cognitive Complexity of 25 (exceeds 5 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.)'
- 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"