CA011 - Too many arguments

Description

A feature that has too many arguments should be avoided since it makes the class interface complicated and is not easy to use. The feature arguments may include options, which should be considered to be moved to separate features.

Scope feature
Status Enabled
Severity Warning
Applicability All
Score 50
Arguments threashold 4

Example of violation

my_document.print (printer_name, paper_size, postscript_level, print_resolution)

Recommendation

Detect arguments that are really options and create procedures to set them.

In the example, one could write: my_document.set_paper_size (paper_size) my_document.set_postscript_level (postscript_level) my_document.set_print_resolution (print_resolution) my_document.print (printer_name)

cached: 11/21/2024 3:39:36.000 AM