Showing 503 of 787 total issues
Function addAllIncludes
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function addAllIncludes(parent, includes) {
_.forEach(parent.associations, association => {
if (all !== true && !all.includes(association.associationType)) {
return;
}
Function findOne
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async findOne(options) {
if (options !== undefined && !_.isPlainObject(options)) {
throw new Error(
'The argument passed to findOne must be an options object, use findByPk if you wish to pass a single primary key value'
);
Function transform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function transform($, filePath) {
// The three <span>s are used to draw the menu button icon
$('nav.navigation').prepend($('<button id="navigationHamburger" class="hamburger" type="button"><span class="line"></span><span class="line"></span><span class="line"></span></button>'));
const menuGroupsScripts = fs.readFileSync(path.join(__dirname, '..', 'scripts', 'menu-groups.js'), 'utf8');
$('body').append($(`<script>${menuGroupsScripts}</script>`));
Function handleShowIndexesQuery
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleShowIndexesQuery(data) {
// Group by index name, and collect all fields
data = data.reduce((acc, item) => {
if (!(item.index_name in acc)) {
acc[item.index_name] = item;
Function _invokeCustomValidator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _invokeCustomValidator(validator, validatorType, optAttrDefined, optValue, optField) {
let isAsync = false;
const validatorArity = validator.length;
// check if validator is async and requires a callback
Function removeConstraint
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async removeConstraint(tableName, constraintName, options) {
const sql = this.queryGenerator.showConstraintsQuery(
tableName.tableName
? tableName
: {
Function jsonPathExtractionQuery
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
jsonPathExtractionQuery(column, path) {
let paths = _.toPath(path);
let pathStr;
const quotedColumn = this.isIdentifierQuoted(column) ? column : this.quoteIdentifier(column);
Function _logQuery
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_logQuery(sql, debugContext, parameters) {
const { connection, options } = this;
const benchmark = this.sequelize.options.benchmark || options.benchmark;
const logQueryParameters = this.sequelize.options.logQueryParameters || options.logQueryParameters;
const startTime = Date.now();
Function _injectAttributes
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_injectAttributes() {
const newAttributes = {
[this.foreignKey]: {
type: this.options.keyType || this.source.rawAttributes[this.sourceKeyAttribute].type,
allowNull: true,
Function formatBindParameters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static formatBindParameters(sql, values, dialect) {
const stringReplaceFunc = value => (typeof value === 'string' ? value.replace(/\0/g, '\\0') : value);
let bindParam;
if (Array.isArray(values)) {
- 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 _refreshTypeParser
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_refreshTypeParser(dataType) {
const arrayParserBuilder = parser => {
return value => this.lib.types.arrayParser.create(value, parser).parse();
};
const rangeParserBuilder = parser => {
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
attributesToSQL(attributes, options) {
const result = {},
existingConstraints = [];
let key, 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 format
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
format(value, field, options, bindParam) {
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"
Further reading
Function describeTable
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async describeTable(tableName, options) {
let schema = null;
let schemaDelimiter = null;
if (typeof options === 'string') {
- 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 initPools
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
initPools() {
const config = this.config;
if (!config.replication) {
this.pool = new Pool({
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
async destroy(options) {
options = {
hooks: true,
force: false,
...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 upsert
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async upsert(tableName, insertValues, updateValues, where, options) {
const model = options.model;
const wheres = [];
options = { ...options };
Function run
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async run(sql, parameters) {
this.sql = sql;
const { connection, options } = this;
const showWarnings = this.sequelize.options.showWarnings || options.showWarnings;
Function handleInsertQuery
has 27 lines of code (exceeds 25 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;
Function removeColumn
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async removeColumn(tableName, columnName, options) {
options = options || {};
const [results] = await this.sequelize.query(
this.queryGenerator.getForeignKeyQuery(