CPC G06F 11/3616 (2013.01) | 13 Claims |
1. A method for evaluating code design quality, comprising:
receiving a modification record of the code;
determining probabilities of error-prone patterns in a code based on a compound logic conditional expression including at least one of a result of static scanning of the code and the modification record, including at least one of,
determining a probability of an existence of a shotgun surgery based on a compound logic conditional expression including metrics of afferent coupling, efferent coupling and changing method,
determining a probability of an existence of a divergent change based on a compound logic conditional expression including metrics of revision number, instability and afferent coupling,
determining a probability of an existence of a big design up front based on a compound logic conditional expression including metrics of line of code, line of changed code, class number, changed class number and a statistical average of the metrics,
determining a probability of an existence of a scattered/redundant functionality based on a compound logic conditional expression including metrics of structure similarity and logic similarity,
determining a probability of an existence of a long method based on a compound logic conditional expression including a metric of cyclomatic complexity,
determining a probability of an existence of a complex class based on a compound logic conditional expression including metrics of line of code, attribute number, method number and maximum method cyclomatic complexity,
determining a probability of an existence of a long parameter list based on a compound logic conditional expression including a metric of parameter number, or
determining a probability of an existence of a message chain based on a compound logic conditional expression including a metric of indirect calling number;
inputting the probabilities of each of the error-prone patterns into an artificial neural network;
based on the artificial neural network, connecting the probabilities of each of the error-prone patterns to design principles;
based on the artificial neural network and the connections, determining a prediction result of whether the code violates the design principles and a quantified degree to which the code violates the design principles; and
evaluating the design quality of the code based on the prediction result.
|