Showing 91 of 172 total issues
Function notifyError
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async notifyError(code = 'unknown_error', message = null, context = undefined) {
if (!this.applicationName || !this.command) {
return;
}
Function deserialize
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function deserialize(error) {
if (!error || !error.status) {
throw new Error('Wrong API Error format');
}
- 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 analyzeMongoCollections
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
async analyzeMongoCollections(databaseConnection) {
const collections = await databaseConnection.collections();
if (collections.length === 0) {
this.restoreDefaultState();
throw new EmptyDatabaseError('no collections found', {
- 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(dbDialect, appName) {
const orm = dbDialect === 'mongodb' ? 'mongoose' : 'sequelize';
const dependencies = {
'body-parser': '1.19.0',
chalk: '~1.1.3',
Function connectToMongodb
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
connectToMongodb(options, isSSL) {
let connectionOptionsMongoClient = options.connectionOptions;
if (!connectionOptionsMongoClient) {
connectionOptionsMongoClient = {
useNewUrlParser: true,
Function perform
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
try {
apimap = reorderKeysBasic(apimap);
apimap.data = sortArrayOfObjects(apimap.data);
Function withCurrentProject
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = async function withCurrentProject(config) {
const { assertPresent, inquirer, spinner } = Context.inject();
assertPresent({ inquirer, spinner });
if (config.projectId) {
Function JobStateChecker
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function JobStateChecker(message, oclifExit) {
const { assertPresent, authenticator, env, logger } = Context.inject();
assertPresent({ authenticator, env, logger });
const bar = new ProgressBar(`${message} [:bar] :percent `, { total: 100 });
Function withCurrentProject
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
module.exports = async function withCurrentProject(config) {
const { assertPresent, inquirer, spinner } = Context.inject();
assertPresent({ inquirer, spinner });
if (config.projectId) {
- 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(config, table, fields, references, options = {}) {
const { underscored } = options;
let modelPath = `models/${this.tableToFilename(table)}.js`;
if (config.appConfig.useMultiDatabase) {
modelPath = `models/${config.appConfig.modelsExportPath}/${this.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 runAuthenticated
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async runAuthenticated() {
const parsed = await this.parse(DeleteCommand);
const config = { ...this.env, ...parsed.flags, ...parsed.args };
const manager = new EnvironmentManager(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 environmentVariablesAutoFilling
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
async environmentVariablesAutoFilling() {
if (this.environmentVariables.projectOrigin !== 'In-app') {
const existingEnvFile = this.fs.existsSync('.env');
const response = await this.inquirer.prompt([
{
- 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 buildDatabaseUrl
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export default function buildDatabaseUrl(dbConfig: DbConfig): string | null {
let connectionString: string;
if (!dbConfig) {
return 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 runAuthenticated
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
async runAuthenticated() {
const parsed = await this.parse(BranchCommand);
const envSecret = this.env.FOREST_ENV_SECRET;
const commandOptions = { ...parsed.flags, ...parsed.args, envSecret };
let config;
Function perform
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = async table => {
const replacements = { table, schemaName: queryInterface.sequelize.config.database };
const query = `
SELECT DISTINCT
tableConstraints.constraint_type AS columnType,
Function render
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(environment, config) {
const table = new this.Table({
chars,
});
Function developmentEnvironmentCreation
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async developmentEnvironmentCreation() {
let developmentEnvironment;
try {
developmentEnvironment = await new ProjectManager(
this.config,
Function runAuthenticated
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async runAuthenticated() {
try {
const config = await this.getConfig();
const branches = (await BranchManager.getBranches(config.envSecret)) || [];
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 runAuthenticated
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
async runAuthenticated() {
const parsed = await this.parse(ResetCommand);
const envSecret = this.env.FOREST_ENV_SECRET;
const commandOptions = { ...parsed.flags, ...parsed.args, envSecret };
let 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"