I've used Code Formatter to reformat the SourceForge Report Manager project (http://reportman.sourceforge.net/). You have certainly made it a great deal easier to read.
Here are some suggestions for possible improvements :
1. After selecting an input file, the disabled/enabled menu isn't
refreshed.
2. Add pop-up hints to all Settings dialog items and link them to the
relevant Help topic.
3. Make obfuscation a separate application. Why obfuscate when formatting ? It's only a test for worst-case obfuscation, isn't it ?
4. Option to insert a space before an open round bracket in class declarations. Despite CodeGear's style, it adds clarity.
5. "Separate", not "Seperate"
6. Is Find and Replace really appropriate - isn't it better to encourage
use of Delphi refactoring ? But, instead, a list of "Do not change" in Capitalisation. But if Find and Replace retained, make it clear that it won't apply to string literals and comments, and have a "whole words only" option.
7. Are syntax reports appropriate ? For example, overridden methods or standard event handlers may not use parameters in some cases. Case statements may not need "else" if a pre-existing value is to remain.
8. Colon and Equals alignment. If successive lines contain colons or
equals (in code), it's neater to align them on the colon e.g.
OneValue := 1;
AnotherValue := 2;
Likewise, lists of variable declarations.
9. Option to line-break in variable lists e.g.
OneValue, AnotherValue : integer
OneValue,
AnotherValue : integer
10. Blank lines. Improves code readability to insert a single blank line after method, procedure and function declarations in implementation, const and var blocks, and around code blocks such as if-begin-end and
if-begin-end-else-begin-end, while, repeat, case, try, etc.
11. Option to remove unnecessary brackets as in :
if (single condition) then
12. Option to keep single-line case code on the same line as the case value
13. Option to remove empty Private, Public and Protected sections in method declarations
14. Option to insert spaces around .. in [x .. y]
15. Option to insert space between trailing character and [
16. Option not to insert a line-break (and extra indentation) between else and if :
if test = x then
..
else if test = y then
..
else if test = z then
etc.
That helps to ensure that all "end"s align with their "begin"s
17. Is colon alignment working properly ?
abc : integer;
ab : string;
becomes
abc : integer;
ab : string;
but no change to
ab : integer;
abc : string;
18. Option not to indent stacked conditions :
if test
or test then
if test
and test then
19. Delete extra blank lines above a specified number (default 2)
21. If a one-line comment immediately precedes code, align the comment to the code
22. Rejoin split code lines if under user-specified width limit (e.g. 78 characters )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anthony,
I've used Code Formatter to reformat the SourceForge Report Manager project (http://reportman.sourceforge.net/). You have certainly made it a great deal easier to read.
Here are some suggestions for possible improvements :
1. After selecting an input file, the disabled/enabled menu isn't
refreshed.
2. Add pop-up hints to all Settings dialog items and link them to the
relevant Help topic.
3. Make obfuscation a separate application. Why obfuscate when formatting ? It's only a test for worst-case obfuscation, isn't it ?
4. Option to insert a space before an open round bracket in class declarations. Despite CodeGear's style, it adds clarity.
5. "Separate", not "Seperate"
6. Is Find and Replace really appropriate - isn't it better to encourage
use of Delphi refactoring ? But, instead, a list of "Do not change" in Capitalisation. But if Find and Replace retained, make it clear that it won't apply to string literals and comments, and have a "whole words only" option.
7. Are syntax reports appropriate ? For example, overridden methods or standard event handlers may not use parameters in some cases. Case statements may not need "else" if a pre-existing value is to remain.
8. Colon and Equals alignment. If successive lines contain colons or
equals (in code), it's neater to align them on the colon e.g.
OneValue := 1;
AnotherValue := 2;
Likewise, lists of variable declarations.
9. Option to line-break in variable lists e.g.
OneValue, AnotherValue : integer
OneValue,
AnotherValue : integer
10. Blank lines. Improves code readability to insert a single blank line after method, procedure and function declarations in implementation, const and var blocks, and around code blocks such as if-begin-end and
if-begin-end-else-begin-end, while, repeat, case, try, etc.
11. Option to remove unnecessary brackets as in :
if (single condition) then
12. Option to keep single-line case code on the same line as the case value
13. Option to remove empty Private, Public and Protected sections in method declarations
14. Option to insert spaces around .. in [x .. y]
15. Option to insert space between trailing character and [
16. Option not to insert a line-break (and extra indentation) between else and if :
if test = x then
..
else if test = y then
..
else if test = z then
etc.
That helps to ensure that all "end"s align with their "begin"s
17. Is colon alignment working properly ?
abc : integer;
ab : string;
becomes
abc : integer;
ab : string;
but no change to
ab : integer;
abc : string;
18. Option not to indent stacked conditions :
if test
or test then
if test
and test then
19. Delete extra blank lines above a specified number (default 2)
21. If a one-line comment immediately precedes code, align the comment to the code
22. Rejoin split code lines if under user-specified width limit (e.g. 78 characters )
Good suggestions, some of them should be bug reports, some feature requests.
"After selecting an input file" -> is this in the IDE plugin, or the Gui or notepad front end?
I don't know when I'll get time to do all of them.
<"After selecting an input file" -> is this in the IDE plugin, or the Gui or notepad front end? >
In the Gui. I haven't tried the others.