Skip to content

Commit a3b5984

Browse files
authored
refactor(core): Lint for cyclomatic complexity in BE packages (no-changelog) (#9111)
1 parent 9eab357 commit a3b5984

31 files changed

+40
-1
lines changed

packages/cli/.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module.exports = {
2020

2121
rules: {
2222
'n8n-local-rules/no-dynamic-import-template': 'error',
23+
complexity: 'error',
2324

2425
// TODO: Remove this
2526
'import/no-cycle': 'warn',

packages/cli/src/CurlConverterHelper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ const mapCookies = (cookies: CurlJson['cookies']): { cookie: string } | {} => {
262262
};
263263
};
264264

265+
// eslint-disable-next-line complexity
265266
export const toHttpNodeParameters = (curlCommand: string): HttpNodeParameters => {
266267
const curlJson = curlToJson(curlCommand);
267268

packages/cli/src/InternalHooks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ export class InternalHooks {
339339
]);
340340
}
341341

342+
// eslint-disable-next-line complexity
342343
async onWorkflowPostExecute(
343344
executionId: string,
344345
workflow: IWorkflowBase,

packages/cli/src/PublicApi/v1/handlers/credentials/credentials.service.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export function toJsonSchema(properties: INodeProperties[]): IDataObject {
158158
// object in the JSON Schema definition. This allows us
159159
// to later validate that only this properties are set in
160160
// the credentials sent in the API call.
161+
// eslint-disable-next-line complexity
161162
properties.forEach((property) => {
162163
if (property.required) {
163164
requiredFields.push(property.name);

packages/cli/src/WebhookHelpers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ const normalizeFormData = <T>(values: Record<string, T | T[]>) => {
217217
/**
218218
* Executes a webhook
219219
*/
220+
// eslint-disable-next-line complexity
220221
export async function executeWebhook(
221222
workflow: Workflow,
222223
webhookData: IWebhookData,
@@ -625,6 +626,7 @@ export async function executeWebhook(
625626
executionId,
626627
) as Promise<IExecutionDb | undefined>;
627628
executePromise
629+
// eslint-disable-next-line complexity
628630
.then(async (data) => {
629631
if (data === undefined) {
630632
if (!didSendResponse) {

packages/cli/src/commands/executeBatch.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ export class ExecuteBatch extends BaseCommand {
166166
await this.initExternalHooks();
167167
}
168168

169+
// eslint-disable-next-line complexity
169170
async run() {
170171
const { flags } = await this.parse(ExecuteBatch);
171172
ExecuteBatch.debug = flags.debug;

packages/cli/src/commands/export/credentials.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export class ExportCredentialsCommand extends BaseCommand {
4848
}),
4949
};
5050

51+
// eslint-disable-next-line complexity
5152
async run() {
5253
const { flags } = await this.parse(ExportCredentialsCommand);
5354

packages/cli/src/commands/export/workflow.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export class ExportWorkflowsCommand extends BaseCommand {
4141
}),
4242
};
4343

44+
// eslint-disable-next-line complexity
4445
async run() {
4546
const { flags } = await this.parse(ExportWorkflowsCommand);
4647

packages/cli/src/databases/dsl/Column.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export class Column {
7272
return this;
7373
}
7474

75+
// eslint-disable-next-line complexity
7576
toOptions(driver: Driver): TableColumnOptions {
7677
const { name, type, isNullable, isPrimary, isGenerated, length } = this;
7778
const isMysql = 'mysql' in driver;

packages/cli/src/eventbus/MessageEventBus/MessageEventBus.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export class MessageEventBus extends EventEmitter {
8585
*
8686
* Sets `isInitialized` to `true` once finished.
8787
*/
88+
// eslint-disable-next-line complexity
8889
async initialize(options?: MessageEventBusInitializeOptions): Promise<void> {
8990
if (this.isInitialized) {
9091
return;

0 commit comments

Comments
 (0)