mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 11:22:15 +00:00
refactor(core): Lint for cyclomatic complexity in BE packages (no-changelog) (#9111)
This commit is contained in:
@@ -20,6 +20,7 @@ module.exports = {
|
||||
|
||||
rules: {
|
||||
'n8n-local-rules/no-dynamic-import-template': 'error',
|
||||
complexity: 'error',
|
||||
|
||||
// TODO: Remove this
|
||||
'import/no-cycle': 'warn',
|
||||
|
||||
@@ -262,6 +262,7 @@ const mapCookies = (cookies: CurlJson['cookies']): { cookie: string } | {} => {
|
||||
};
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export const toHttpNodeParameters = (curlCommand: string): HttpNodeParameters => {
|
||||
const curlJson = curlToJson(curlCommand);
|
||||
|
||||
|
||||
@@ -339,6 +339,7 @@ export class InternalHooks {
|
||||
]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async onWorkflowPostExecute(
|
||||
executionId: string,
|
||||
workflow: IWorkflowBase,
|
||||
|
||||
@@ -158,6 +158,7 @@ export function toJsonSchema(properties: INodeProperties[]): IDataObject {
|
||||
// object in the JSON Schema definition. This allows us
|
||||
// to later validate that only this properties are set in
|
||||
// the credentials sent in the API call.
|
||||
// eslint-disable-next-line complexity
|
||||
properties.forEach((property) => {
|
||||
if (property.required) {
|
||||
requiredFields.push(property.name);
|
||||
|
||||
@@ -217,6 +217,7 @@ const normalizeFormData = <T>(values: Record<string, T | T[]>) => {
|
||||
/**
|
||||
* Executes a webhook
|
||||
*/
|
||||
// eslint-disable-next-line complexity
|
||||
export async function executeWebhook(
|
||||
workflow: Workflow,
|
||||
webhookData: IWebhookData,
|
||||
@@ -625,6 +626,7 @@ export async function executeWebhook(
|
||||
executionId,
|
||||
) as Promise<IExecutionDb | undefined>;
|
||||
executePromise
|
||||
// eslint-disable-next-line complexity
|
||||
.then(async (data) => {
|
||||
if (data === undefined) {
|
||||
if (!didSendResponse) {
|
||||
|
||||
@@ -166,6 +166,7 @@ export class ExecuteBatch extends BaseCommand {
|
||||
await this.initExternalHooks();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async run() {
|
||||
const { flags } = await this.parse(ExecuteBatch);
|
||||
ExecuteBatch.debug = flags.debug;
|
||||
|
||||
@@ -48,6 +48,7 @@ export class ExportCredentialsCommand extends BaseCommand {
|
||||
}),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async run() {
|
||||
const { flags } = await this.parse(ExportCredentialsCommand);
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ export class ExportWorkflowsCommand extends BaseCommand {
|
||||
}),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async run() {
|
||||
const { flags } = await this.parse(ExportWorkflowsCommand);
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ export class Column {
|
||||
return this;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
toOptions(driver: Driver): TableColumnOptions {
|
||||
const { name, type, isNullable, isPrimary, isGenerated, length } = this;
|
||||
const isMysql = 'mysql' in driver;
|
||||
|
||||
@@ -85,6 +85,7 @@ export class MessageEventBus extends EventEmitter {
|
||||
*
|
||||
* Sets `isInitialized` to `true` once finished.
|
||||
*/
|
||||
// eslint-disable-next-line complexity
|
||||
async initialize(options?: MessageEventBusInitializeOptions): Promise<void> {
|
||||
if (this.isInitialized) {
|
||||
return;
|
||||
|
||||
@@ -250,6 +250,7 @@ export class MessageEventBusDestinationWebhook
|
||||
return null;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async receiveFromEventBus(emitterPayload: MessageWithCallback): Promise<boolean> {
|
||||
const { msg, confirmCallback } = emitterPayload;
|
||||
let sendResult = false;
|
||||
|
||||
@@ -16,6 +16,7 @@ export class ExecutionDataRecoveryService {
|
||||
private readonly executionRepository: ExecutionRepository,
|
||||
) {}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async recoverExecutionData(
|
||||
executionId: string,
|
||||
messages: EventMessageTypes[],
|
||||
|
||||
@@ -166,6 +166,7 @@ export class CredentialsTester {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async testCredentials(
|
||||
user: User,
|
||||
credentialType: string,
|
||||
|
||||
@@ -11,6 +11,7 @@ import { TestWebhooks } from '@/TestWebhooks';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
export async function handleCommandMessageMain(messageString: string) {
|
||||
const queueModeId = config.getEnv('redis.queueModeId');
|
||||
const isMainInstance = config.getEnv('generic.instanceType') === 'main';
|
||||
|
||||
@@ -12,6 +12,7 @@ import { Logger } from '@/Logger';
|
||||
import { N8N_VERSION } from '@/constants';
|
||||
|
||||
export function getWorkerCommandReceivedHandler(options: WorkerCommandReceivedHandlerOptions) {
|
||||
// eslint-disable-next-line complexity
|
||||
return async (channel: string, messageString: string) => {
|
||||
if (channel === COMMAND_REDIS_CHANNEL) {
|
||||
if (!messageString) return;
|
||||
|
||||
@@ -55,6 +55,7 @@ export class WorkflowService {
|
||||
: { workflows, count };
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
async update(
|
||||
user: User,
|
||||
workflow: WorkflowEntity,
|
||||
|
||||
@@ -95,6 +95,7 @@ export const setupTestServer = ({
|
||||
license: new LicenseMocker(),
|
||||
};
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
beforeAll(async () => {
|
||||
await testDb.init();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user