Number of lines exceeds threshold
The number of total lines in a file is greater than the defined threshold
Since R2021a
Description
This defect is raised on a file when the number of total lines in the file is greater than
the defined threshold of the checker. For details about how Polyspace calculates the total
number of lines in a file, see Number of
Lines
.
Polyspace® uses the default threshold 10,000 unless you specify a threshold for the
checker. To specify a selection file where you can set the threshold, use the option
Set checkers by file (-checkers-selection-file)
or Checkers activation file
(-checkers-activation-file)
.
When you import comments from previous analyses by using polyspace-comments-import
, Polyspace copies any review information on the code metric Number of Lines
in the previous result to this
checker in the current result. If the current result contains the same code metric, the review
information is copied to the code metric as well.
Risk
Violation of this checker might indicate that:
The file is too long.
The file contains too many different functions.
The file contains too many verbose comments.
These factors make the file difficult to maintain and debug.
Fix
To fix this check, either refactor your code or change the checker threshold. When refactoring the code, design the modules of your project so that:
Related and independent code is encapsulated and separated.
The modules are separated based on tasks of appropriate scope.
A best practice is to check the complexity of a module early in development to avoid costly post-development refactoring.
Examples
Check Information
Group: Software Complexity |
Language: C | C++ |
Acronym:
SC01
|
Default Threshold: 10000 |
Version History
Introduced in R2021a