Method and system for automatically checking computer source code quality based on rules
AssigneeParasoft Corporation
InventorsAdam K. Kolawa, Michael A. G. Aivazis, Wendell T. Hicken, Bryan R. Strickland
Life of this patent
Estimating the term…
Abstract
A method and system for automatically checking the quality of computer source code based on rules for identifying quality concerns. The computer source code comprises instructions for execution on the computer. Each of the instructions are represented by at least one node stored in a parse tree. Both the parse tree and the rules are stored in the computer. A violation of one of the rules is checked by examining each of the instructions as represented by nodes in the parse tree. An error message for describing the quality concern identified is generated whenever such a rule violation is found in the computer source code.
Claims13
A method using a computer for automatically checking the quality of computer source code based on rules for identifying quality concerns, the computer source code comprising instructions for execution on the computer, each of the instructions being represented by at least one node stored in a parse tree wherein each node has a node type and each of the rules is represented by at least one such node type, each of the rules being further represented by a matching function associated with at least one of the node types for the rule, the matching function iterattively processing a list of nodes for describing the characteristics of the rule, both the parse tree and the rules being stored in the computer, comprising the steps of:
- checking for a violation of one of the rules by examining each of the instructions as represented by nodes in the parse tree;
- obtaining a list of node types for the rule being checked;
- searching for nodes in the parse tree having a node type matching one of the node types in the list of node types;
- performing the matching function associated with the matching node type for determining whether the rule has been violated;
- and
- generating an error message for describing the quality concern identified whenever such a rule violation is found in the computer source code.
A method using a computer for automatically checking the quality of computer source code based on rules for identifying quality concerns, the computer source code comprising instructions for execution on the computer, each of the instructions being represented by at least one node stored in a parse tree, wherein the type of node selected represents a composite type comprising a plurality of nodes in the parse tree, both the parse tree and the rules being stored in the computer, comprising the steps of:
- checking for a violation of one of the rules by examining each of the instructions as represented by nodes in the parse tree;
- generating an error message for describing the quality concern identified whenever such a rule violation is found in the computer source code;
- and
- performing a tree search function for recursively stripping fields from each of the plurality of nodes to obtain a token used to ensure correct rule violation identification.
A method using a computer for automatically checking the quality of computer source code based on rules for identifying quality concerns, the computer source code comprising instructions for execution on the computer, each of the instructions being represented by at least one node stored in a parse tree, both the parse tree and the rules being stored in the computer, comprising the steps of:
- checking for a violation of one of the rules by examining each of the instructions as represented by nodes in the parse tree;
- storing information for indicating parse tree context into an error record for use in describing the quality concern identified, wherein the error record comprises a severity level for indicating the seriousness of the rule violation;
- determining a severity level whenever such a rule violation is found in the computer source code;
- indicating the severity level;
- and
- generating an error message for describing the quality concern identified whenever such a rule violation is found in the computer source code.
A method using a computer for automatically checking the quality of computer source code based on rules for identifying quality concerns, the computer source code comprising instructions for execution on the computer, each of the instructions being represented by at least one node stored in a parse tree, both the parse tree and the rules being stored in the computer, comprising the steps of:
- checking for a violation of one of the rules by examining each of the instructions as represented by nodes in the parse tree;
- storing information for indicating parse tree context into an error record for use in describing the quality concern identified, wherein the error record comprises a confidence level for providing a level of certainty that the rule has been violated;
- determining a confidence level whenever such a rule violation is found in the computer source code;
- and
- indicating the confidence level;
- and
- generating an error message for describing the quality concern identified whenever such a rule violation is found in the computer source code.
A method using a computer for automatically checking the quality of computer source code based on rules for identifying quality concerns, the computer source code comprising instructions for execution on the computer, each of the instructions being represented by at least one node stored in a parse tree, both the parse tree and the rules being stored in the computer, comprising the steps of:
- checking for a violation of one of the rules by examining each of the instructions as represented by nodes in the parse tree;
- storing information for indicating parse tree context into an error record for use in describing the quality concern identified, wherein the error record comprises an error code;
- determining whether a special message is required based on the error code;
- processing the special message;
- and
- generating an error message for describing the quality concern identified whenever such a rule violation is found in the computer source code.
A method using a computer for checking computer source code to identify violations of quality rules, the computer source code comprising instructions for execution on the computer, each quality rule comprising a set of node types, both the computer source code and the quality rules being stored in the computer, each quality rule further comprising a matching function for iterattively processing a list of nodes for describing the characteristics of the rule, comprising the steps of:
- providing the instructions for the computer source code to the computer stored in a parse tree comprising at least one node having a node type for each instruction;
- selecting such a quality rule for identifying whether the selected quality rule has been violated by the computer source code;
- searching the parse tree node for a match between such a node in the parse tree having a node type that matches such a node type in the set of node types for the selected quality rule;
- providing a list of node types for describing the types of nodes in the parse tree to search for identifying each rule violation;
- comparing each node in the parse tree to each node type in the list of node types;
- performing the matching function;
- and
- generating an error message for describing the violation for the selected quality rule.
A method using a computer for checking computer source code to identify violations of quality rules, the computer source code comprising instructions for execution on the computer, each quality rule comprising a set of node types, both the computer source code and the quality rules being stored in the computer, comprising the steps of:
- providing the instructions for the computer source code to the computer stored in a parse tree comprising at least one node having a node type for each instruction;
- selecting such a quality rule for identifying whether the selected quality rule has been violated by the computer source code;
- searching the parse tree for a match between such a node in the parse tree having a node type that matches such a node type in the set of node types for the selected quality rule;
- generating an error message for describing the violation for the selected quality rule;
- determining whether an error message should be suppressed;
- and
- suppressing the error message if so determined.
A method using a computer for checking computer source code to identify violations of quality rules, the computer source code comprising instructions for execution on the computer, each quality rule comprising a set of node types, both the computer source code and the quality rules being stored in the computer, comprising the steps of:
- providing the instructions for the computer source code to the computer stored in a parse tree comprising at least one node having a node type for each instruction;
- selecting such a quality rule for identifying whether the selected quality rule has been violated by the computer source code;
- searching the parse tree for a match between such a node in the parse tree having a node type that matches such a node type in the set of node types for the selected quality rule;
- generating an error message for describing the violation for the selected quality rule;
- and
- generating an error message comprising at least one of a severity level for indicating the seriousness of the rule violation or a confidence level for providing a level of certainty that the rule has been violated.
Dependencies are inferred from the claim text.