Showing 53 of 79 total issues
Function connectToMongodb
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
connectToMongodb(options, isSSL) {
let connectionOptionsMongoClient = options.connectionOptions;
if (!connectionOptionsMongoClient) {
connectionOptionsMongoClient = {
useNewUrlParser: true,
- 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 createProject
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async createProject(config, sessionToken, project) {
let newProject;
try {
newProject = await this.agent
- 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 writePackageJson
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
writePackageJson(projectPath, { dbDialect, appName }) {
const orm = dbDialect === 'mongodb' ? 'mongoose' : 'sequelize';
const dependencies = {
'body-parser': '1.19.0',
chalk: '~1.1.3',
Function createReference
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createReference(
tableName,
existingsReferences,
association,
foreignKey,
Function mapCollection
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapCollection() {
function allItemsAreObjectIDs(array) {
if (!array.length) return false;
var itemToCheckCount = array.length > 3 ? 3 : array.length;
var arrayOfObjectIDs = true;
Function handleHostname
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
handleHostname() {
if (this.isOptionRequested('appHostname')) {
this.envConfig.appHostname = this.program.applicationHost;
if (!this.envConfig.appHostname) {
this.prompts.push({
- 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 createAccount
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async createAccount() {
this.logger.info('Create an account:');
const authConfig = await this.inquirer.prompt([{
type: 'input',
name: 'firstName',
- 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 writeModel
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
writeModel(projectPath, config, table, fields, references, options = {}) {
const { underscored } = options;
let modelPath = `models/${Dumper.tableToFilename(table)}.js`;
if (config.useMultiDatabase) {
modelPath = `models/${config.modelsExportPath}/${Dumper.tableToFilename(table)}.js`;
- 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 add
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
add(key, options, promise = null) {
spinnies.add(key, options);
const spinner = {
succeed(succeedOptions) {
Function analyzeMongoCollections
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function analyzeMongoCollections(databaseConnection) {
const schema = {};
return databaseConnection.collections()
.then(async (collections) => {
Function loginWithEmailOrTokenArgv
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
async loginWithEmailOrTokenArgv(config) {
try {
const { email, token } = config;
let { password } = config;
Function ColumnTypeGetter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function ColumnTypeGetter(databaseConnection, schema, allowWarning = true) {
const queryInterface = databaseConnection.getQueryInterface();
function isDialect(dialect) {
return queryInterface.sequelize.options.dialect === dialect;
- 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 handleSsl
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
handleSsl() {
if (this.isOptionRequested('ssl')) {
const { ssl } = this.program;
if (ssl) {
try {
- 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 handleSsl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSsl() {
if (this.isOptionRequested('ssl')) {
const { ssl } = this.program;
if (ssl) {
try {
Function analyzeFields
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function analyzeFields(queryInterface, tableName, config) {
const dialect = queryInterface.sequelize.getDialect();
let columnsByName;
// Workaround bug in sequelize/dialects/mysql/query-generator#describe
Function parseGeneric
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
parseGeneric() {
const nulls = ['NULL'];
const falses = ['false', 'FALSE', 'b\'0\'', '((0))'];
const trues = ['true', 'TRUE', 'b\'1\'', '((1))'];
const isDate = ['TIMESTAMP', 'DATETIME', 'DATE', 'TIME'];
- 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 getDialect
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
getDialect(dbConnectionUrl, dbDialect) {
if (dbConnectionUrl) {
if (dbConnectionUrl.startsWith('postgres://')) { return 'postgres'; }
if (dbConnectionUrl.startsWith('mysql://')) { return 'mysql'; }
if (dbConnectionUrl.startsWith('mssql://')) { return 'mssql'; }
- 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 loginWithEmailOrTokenArgv
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async loginWithEmailOrTokenArgv(config) {
try {
const { email, token } = config;
let { password } = config;
- 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 TableConstraintsGetter
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function TableConstraintsGetter(databaseConnection, schema) {
const queryInterface = databaseConnection.getQueryInterface();
this.perform = async (table) => {
let query = 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 handlePort
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
handlePort() {
if (this.isOptionRequested('dbPort')) {
this.prompts.push({
type: 'input',
name: 'dbPort',
- 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"