refactor(core): Lint for cyclomatic complexity in BE packages (no-changelog) (#9111)

This commit is contained in:
Iván Ovejero
2024-04-10 14:02:02 +02:00
committed by GitHub
parent 9eab357b75
commit a3b59843d5
31 changed files with 40 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ module.exports = {
...sharedOptions(__dirname),
rules: {
complexity: 'error',
// TODO: remove these
'import/order': 'off',
'@typescript-eslint/no-base-to-string': 'warn',

View File

@@ -104,6 +104,7 @@ export class Expression {
* @param {boolean} [returnObjectAsString=false]
*/
// TODO: Clean that up at some point and move all the options into an options object
// eslint-disable-next-line complexity
resolveSimpleParameterValue(
parameterValue: NodeParameterValue,
siblingParameters: INodeParameters,

View File

@@ -127,6 +127,7 @@ export const extendTransform = (expression: string): { code: string } | undefine
// Polyfill optional chaining
visit(ast, {
// eslint-disable-next-line complexity
visitChainExpression(path) {
this.traverse(path);
const chainNumber = currentChain;

View File

@@ -607,6 +607,7 @@ export function getParameterResolveOrder(
* @param {boolean} [dataIsResolved=false] If nodeValues are already fully resolved (so that all default values got added already)
* @param {INodeParameters} [nodeValuesRoot] The root node-parameter-data
*/
// eslint-disable-next-line complexity
export function getNodeParameters(
nodePropertiesArray: INodeProperties[],
nodeValues: INodeParameters | null,
@@ -1388,6 +1389,7 @@ function isINodeParameterResourceLocator(value: unknown): value is INodeParamete
* @param {INodeParameters} nodeValues The values of the node
* @param {string} path The path to the properties
*/
// eslint-disable-next-line complexity
export function getParameterIssues(
nodeProperties: INodeProperties,
nodeValues: INodeParameters,

View File

@@ -121,6 +121,7 @@ function parseRegexPattern(pattern: string): RegExp {
return regex;
}
// eslint-disable-next-line complexity
export function executeFilterCondition(
condition: FilterConditionValue,
filterOptions: FilterOptionsValue,

View File

@@ -743,6 +743,7 @@ export class RoutingNode {
return parameterValue;
}
// eslint-disable-next-line complexity
getRequestOptionsFromParameters(
executeSingleFunctions: IExecuteSingleFunctions,
nodeProperties: INodeProperties | INodePropertyOptions,

View File

@@ -151,6 +151,7 @@ export function generateNodesGraph(
};
});
// eslint-disable-next-line complexity
otherNodes.forEach((node: INode, index: number) => {
nodeGraph.node_types.push(node.type);
const nodeItem: INodeGraphItem = {

View File

@@ -178,6 +178,7 @@ type ValidateFieldTypeOptions = Partial<{
parseStrings: boolean;
}>;
// Validates field against the schema and tries to parse it to the correct type
// eslint-disable-next-line complexity
export const validateFieldType = (
fieldName: string,
value: unknown,

View File

@@ -1264,6 +1264,7 @@ export class Workflow {
* Executes the given node.
*
*/
// eslint-disable-next-line complexity
async runNode(
executionData: IExecuteData,
runExecutionData: IRunExecutionData,

View File

@@ -738,6 +738,7 @@ export class WorkflowDataProxy {
});
};
// eslint-disable-next-line complexity
const getPairedItem = (
destinationNodeName: string,
incomingSourceData: ISourceData | null,

View File

@@ -115,6 +115,7 @@ const STATUS_CODE_MESSAGES: IStatusCodeMessages = {
export class NodeApiError extends NodeError {
httpCode: string | null;
// eslint-disable-next-line complexity
constructor(
node: INode,
errorResponse: JsonObject,