Cleaning Delphi code?

0 like 0 dislike
76 views
There is a large (several hundred thousand lines) the project on Delphi, which is about 10 years.

I guess worked on it for more than a dozen developers. Therefore, it is possible to see various manifestations of human stupidity, negligence, krivorukost and other unpleasant things.

I would like a little project this comb, and as this process to automate (because manually this can take up to one week). Namely:

— remove commented out code blocks

— remove code that does not link to an executable file

— remove unused uses

— remove pas/dfm files that do not belong to the project

— all previous steps have been fully controlled


Well, desirable, different buns, the format type code for the template, identify potentially dangerous or just suspicious locations, etc. But the code cleanup (the above points) is the priority.
by | 76 views

7 Answers

0 like 0 dislike
Automatically will not work.
Uses can not be removed, since delphi 6 does not need not be connected.
Pas/dfm I have manually deleted everything that was not in the project file — then return it necessary.
Format to the same species does not suggest — then it is very difficult to compare the changes.
by
0 like 0 dislike
Better handles, written quickly, can be adjusted optimally for themselves. It is better to use ready engines / components for parsing delphi code (a lot of them, many are available without problems) and easy to follow-up. Look at torry.net.
\r
Although there are a number of non-trivial tasks (for example, the evaluation of the coating — coverage) that are better handled ready-made tools (for example, AQTime trial), for the sake of saving time. Although it is possible to decide for himself.
\r
But after a couple of days out the solution to that, IMHO, is not ashamed to spread to the public and to help many in the future :)
by
0 like 0 dislike
But because it was necessary to use VCS. And anyway... the Current state of Delphi is reminiscent of the "convulsions of a dying rhinoceros"(C)
by
0 like 0 dislike
Refactoring a large project can drag on for months, it is necessary to you? Can refactor only potentially buggy, brake stations, with the aim of visible optimize?
by
0 like 0 dislike
To format advise GExperts (Experimental).
For the rest of the CnPack Wizards to come.
by
0 like 0 dislike
to format better DelForEx yet
cleaning uses as I recall is possible in CnPack
but remove the commented code, easily done in any editor that supports the regular season. For example how to use search in GExperts for \\(\\*.*\\*\\) and when the results to the empty string (there is an item replace all items)
unused code can be removed best by a specialized software. AQTime here gave up already, I can recommend another Pascal Analyzer
\r
in General, refactoring is long and tedious and Slovavtotrans
by
0 like 0 dislike
In my opinion, the commented out blocks is better not to touch - in the future it will be easier to track the history of changes on the finite size of the application they are not affected.
by

Related questions

0 like 0 dislike
4 answers
0 like 0 dislike
2 answers
asked Sep 10, 2019 by DJZLO
0 like 0 dislike
2 answers
0 like 0 dislike
2 answers
asked Aug 15, 2019 by DJZLO
0 like 0 dislike
2 answers
110,608 questions
257,186 answers
0 comments
32,718 users