Ada Repair takes static analysis of coding-standard violations a step further by automatically creating new versions of your programs that no longer contain the violations. The resulting code is semantically equivalent to the original but with improved maintainability, readability, robustness, and efficiency. For example, the following procedure call embedded in a case statement
will be updated to add missing named parameter association and default parameters to the procedure call, and expand the case range and when others choices. The addition of named parameter association makes the call more readable, reducing future maintenance costs. The addition of the default parameter reduces the risk of future defects when the default is changed for some reason. Expanding the case range and when others choices will make the software more robust and less prone to future defects.
The following repairs can be made to software containing coding violations:
Code Modification | Benefits |
---|---|
Add named parameter association to subprogram calls. | Subprogram calls are more readable and maintainable. |
Add named association to aggregates. | Aggregates are more readable and maintainable. |
Add named association to generic instantiations. | Generic instantiations are more readable and maintainable. |
Add explicit default parameters to subprogram calls using the default. | Add missing in mode specifications to subprograms. |
Subprogram declarations are more explicit and thus more understandable. | |
Move representation clauses immediately after the type they represent. | Software more readable. Required by Ada 95. |
Generate number declarations for literals in subprogram bodies and replace the literal with the named number. | Software is less susceptible to errors resulting from future changes to literal values. |
Expand multiple object and parameter declarations to a list of single declarations. | Software is more explicit and readable. Allows for separate defaults. |
Name loops that are nested. | Software is more readable and allows exit statements to be made explicit. |
Name blocks that are nested. | Software is more readable. |
Replace or and and operators with their short-circuit forms. | Software can be more efficient. |
Replace literal ranges and when others in case statements with actual values (enumeration only). | Case statements are less susceptible to errors resulting from future changes to the list of enumerated values. |
Replace when others in record aggregates when enumerated. | Record aggregates are less susceptible to errors resulting from future changes to the list of enumerated values. |
Replace if then exit with exit when. | Software is more readable and reduces complexity. |
Add explicit loop names to exit statements when possible. | Software is more readable and less susceptible to errors from future changes. |
Qualify references that are not already fully qualified. | Software is more readable, more robust, and can lead to the removal of use clauses. |
Make anonymous array type definitions explicit. | Software is more explicit and readable. |
Add rename declarations for all infix operators used in a unit. | Software is more readable and can lead to the removal of use clauses. |
Generate explicit index types for array types when required. | Software is more readable and allows for use of attributes for lower-bound, upper-bound, and range values. |
Replace raise with an explicit raise when possible. | Software is more readable and robust. |
Replace aliased renames (that is, direct references to the renamed declaration when a rename is available) with the renamed name. | Software is more explicit, consistent, and understandable. |
Remove unused and redundant with clauses. Move with clauses from the spec to the body when possible. | Dependencies and complexity are reduced to minimal require-ments. Can reduce recompilation time. Improves program structure. |
Alphabetize context clauses. | Specific with clauses are easier to locate. |
Alphabetize rename clauses. | Specific rename clauses are easier to locate. |
products
ada repair technical specification | ada repair pdf (280K)
ada analyzer | ada type interchange generator (ATIG) | ada analyzer/ ada repair training
little tree home | about little tree | technical articles | email