could be updated to add the missing named parameter association and the default parameter to the procedure call. The addition of named parameter association makes the call more readable and 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 will make the software more robust and less prone to future defects.
The following repairs can be made to Ada software. Each update is a separate option that can be enabled when that repair is desired.
Code Modification | Benefits | |
---|---|---|
1. | Add named parameter association to procedure calls. | Makes procedure calls more readable and maintainable. |
2. | Add named association to aggregates. | Makes aggregates more readable and maintainable. |
3. | Add named association to generic instantiations. | Makes generic instantiations more readable and maintainable. |
4. | Add explicit default parameters to calls using the default. | Makes procedure calls less susceptible to errors resulting from future changes. |
5. | Add missing "in" mode specifications to subprogram parameters. | Makes procedure declarations more explicit and thus more understandable. |
6. | Adjust "in out" parameters when they are only set (to "out" mode) or only used (to "in mode") | Makes parameters consistent with there actual use. |
7. | Move representation clauses immediately after the type they represent. | Makes the software more readable; Required by Ada95. |
8. | Generate number declarations for literals in subprogram bodies and replace the literal with the named number. | Makes procedure calls less susceptible to errors resulting from future changes. |
9. | Name loops that are nested. | Makes software more readable and allows exit statements to be made explicit. |
10. | Name blocks that are nested. | Makes software more readable. |
11. | Replace "or" and "and" operators with their short-circuit forms. | Can make software more efficient. |
12. | Replace "when others" in case statements with actual values (enumeration only). | Makes case statements less susceptible to errors resulting from future changes. |
13. | Replace literal ranges in case statements with actual values (enumeration only). | Makes case statements less susceptible to errors resulting from future changes. |
14. | Replace "when others" in record aggregates when enumerated. | Makes record aggregates less susceptible to errors resulting from future changes. |
15. | Replace "if then exit" with "exit when". | Makes software more readable and reduces complexity. |
16. | Add explicit loop names to exit when possible. | Makes software more readable and less susceptible to errors from future changes. |
17. | Qualify references that are not already fully qualified. | Makes software more readable, more robust, and can lead to the removal of use clauses. |
18. | Add rename declarations for all infix operators used in a unit. | Makes software more readable and can lead to the removal of use clauses. |
19. | Replace anonymous array type specifications with an explicit array type declaration. | Makes the software more explicit and readable. |
20. | Generate explicit index types for array types when required. | Makes software more readable and allows for use of attributes for lower-bound, upper-bound, and range values. |
21. | Replace "raise;" with explicit raise when possible. | Makes software more readable and robust. |
22. | Replace aliased renames (that is, direct references to the renamed declaration when a rename is available) with the renamed name. | Makes software more explicit and understandable. |
23. | Remove unused and redundant with clauses. Move with clauses from the spec to the body when possible. | Reduces dependencies and complexity to minimal requirements. Can reduce recompilation time. Improves program structure. |
24. | Alphabetize context clauses. | Makes location of specific with clauses easier. |
25. | Alphabetize rename clauses. | Makes location of specific rename clauses easier. |
26. | Replace multi-name context clauses with a series of single-name context clauses. | Makes the software more consistent and readable. Allows for better ordering. |
27. | Replace multi-name declarations with a series of single-name declarations. | Makes the software more consistent and readable. Allows for separate default values. |
Command-Line Interface repair_violations
Option Descriptions:
The following options enable the updates specified in the list of updates on page 1.
. If this option is not enabled, a file called
ada repair | ada repair pdf (280K)
ada type interchange generator (ATIG) | ada analyzer | ada analyzer/ ada repair training
little tree home | about little tree | technical articles | email