Showing 91 of 172 total issues
Function createAllReferences
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createAllReferences(databaseSchema, schemaGenerated) {
const references = {};
Object.keys(databaseSchema).forEach(tableName => {
references[tableName] = [];
});
Function MysqlTableConstraintsGetter
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MysqlTableConstraintsGetter(databaseConnection) {
const queryInterface = databaseConnection.getQueryInterface();
// NOTICE: provide an array of array. Each inner array representing a (possibly composite) unique
// index
Function runAuthenticated
has 49 lines of code (exceeds 25 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);
Function connectToMongodb
has a Cognitive Complexity of 15 (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 constructor
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor({
assertPresent,
logger,
detectReferences,
applyReferences,
Function writeModel
has 47 lines of code (exceeds 25 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`;
Function createFiles
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async createFiles(config, schema) {
const { isUpdate, useMultiDatabase, modelsExportPath } = config.appConfig;
await this.mkdirp(`${this.projectPath}/routes`);
await this.mkdirp(`${this.projectPath}/forest`);
Function runAuthenticated
has 43 lines of code (exceeds 25 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;
Function analyzeMongoCollections
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
async analyzeMongoCollections(databaseConnection) {
const collections = await databaseConnection.collections();
if (collections.length === 0) {
this.restoreDefaultState();
throw new EmptyDatabaseError('no collections found', {
Function mapCollection
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapCollection(keys = this, emitFunction, store) {
// this block is to inject the emit function when this code is running locally
var emitAction;
if (emitFunction && store) {
emitAction = function emit(key, value) {
Function createProject
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.createProject = async (config, sessionToken, project) => {
let newProject;
try {
newProject = await agent
Function createReference
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function createReference(
tableName,
existingsReferences,
association,
foreignKey,
- 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 addObjectSchema
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function addObjectSchema(type, parentSchema, currentKey) {
const isTypeAnArray = Array.isArray(type);
if (parentSchema[currentKey] !== undefined) {
if (areSchemaTypesMixed(parentSchema[currentKey], type)) {
- 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 ApimapSorter
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function ApimapSorter(apimap) {
const { assertPresent, logger, lodash } = inject();
assertPresent({ logger, lodash });
function sortArrayOfObjects(array) {
- 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 createReference
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createReference(
tableName,
existingsReferences,
association,
foreignKey,
Function SchemaSender
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SchemaSender(serializedSchema, secret, authenticationToken, oclifExit) {
/**
* @function
* @returns {Promise<number | undefined>}
*/
Function runAuthenticated
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async runAuthenticated() {
const parsed = await this.parse(PushCommand);
const envSecret = this.env.FOREST_ENV_SECRET;
const commandOptions = { ...parsed.flags, ...parsed.args, envSecret };
let config;
Function constructor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(context) {
super(context);
const {
assertPresent,
Function handleBranchError
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function handleBranchError(rawError) {
const { message, meta } = handleErrorWithMeta(rawError);
switch (message) {
// NOTICE: When no env/project can be found through envSecret
case 'Not Found':
Function perform
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.perform = () => {
const { env, logger } = Context.inject();
return agent
.post(`${env.FOREST_SERVER_URL}/forest/apimaps`)