Skip to content

Add configuration to abc_size and code_complexity to count each function clause independently. #624

@elbrujohalcon

Description

@elbrujohalcon

Is your feature request related to a problem? Please describe

I have plenty of functions with 25 or more clauses. Each clause is complex but not terribly complex.
For instance, one of the functions is an auditory helper. It receives all possible events in the system and, for each one, it decides if it needs to be audited and how (i.e., what information about the event needs to go into the audit DB)… That function has 50 clauses, give or take. Each clause has 10 statements, on average. It is, in fact, a very complex function. But, in reality, each clause acts basically as a function in itself. Therefore, from my point of view, the complexity of the whole function doesn't matter too much, as long as each clause is not too complex on its own.

Describe the solution you'd like

I would like an extra option in the abc_size and code_complexity rules. Something like analysis_level := function | clause. The default still being function, but if the user chooses clause the complexity will be measured for each clause instead of for the whole function.

Describe alternatives you've considered

Disabling the rule for the modules where I have those functions or disabling the rule for the functions in particular, but that still will emit new warnings if I (or any of my colleagues) adds a new complex multi-claused function.

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions