project - count source lines lazarus / 9-Editor ---------------------------------------------------------------------- Nicole · 2025-05-08 17:13 Is there anywhere a tool or a menu, which lists me the count of my code lines? A listing with all my units and code-lines would be best. I use Lazarus 3.0 ---------------------------------------------------------------------- cdbc · 2025-05-08 17:24 Hi Nicole When I compile a project, fpc shows me how many lines it compiled in the message-window... See attachment. Regards Benny ---------------------------------------------------------------------- Martin_fr · 2025-05-08 18:19 The "Code browser" from the View menu shows some stats in its status line. Set the "Search scope" to project. ---------------------------------------------------------------------- Nicole · 2025-05-08 19:09 Thank you for your replies. Unfortunately I have no idea, what you are talking about. The screenshot shows something, I never have seen before and do not know, where it can be from. The menu hints I cannot translate to German. Do you think, you can count the words of the menu-headers and tell me which number to click? e.g. 1 for "file", 2 for "edit"..... I have Lazarus 3.0 under windows 7. ---------------------------------------------------------------------- cdbc · 2025-05-08 19:38 Hi 'View' is #4 and 'CodeBrowser' is #7 down... Regards Benny ---------------------------------------------------------------------- Nicole · 2025-05-09 11:03 thank you! Found it. ---------------------------------------------------------------------- munair · 2025-05-09 20:49 I just happened to write a tool to count code lines, comment lines and such, because I was looking for a bit more stats about my project: https://forum.lazarus.freepascal.org/index.php/topic,71090.0.html ---------------------------------------------------------------------- munair · 2025-05-09 20:58 Quote from: Martin_fr on May 08, 2025, 08:19:12 pmThe "Code browser" from the View menu shows some stats in its status line. Set the "Search scope" to project. From what I can tell, the Code Browser seems to include empty lines. In one of my projects it counts 16085 lines, whereas my tool reports 13251 lines, including code and comments but excluding empty lines. Or the Code Browser counts additional code (not sure what it would be). ---------------------------------------------------------------------- munair · 2025-05-15 08:09 There is now a package that installs in the IDE's Project menu that shows metrics about the files in your project, including comment and empty lines percentage: https://github.com/ssgeos/ProjectMetrics ---------------------------------------------------------------------- wp · 2025-06-03 21:40 @munair: Do you want me to add the ProjectMetrics package to OPM? ---------------------------------------------------------------------- Nicole · 2025-06-04 14:00 Yes, this would be great! I'll wait for it and then take it. ---------------------------------------------------------------------- munair · 2025-06-09 08:21 Quote from: wp on June 03, 2025, 11:40:37 pm@munair: Do you want me to add the ProjectMetrics package to OPM? For sure. ---------------------------------------------------------------------- munair · 2025-06-09 08:23 wp added some enhancements: https://github.com/ssgeos/ProjectMetrics ---------------------------------------------------------------------- wp · 2025-07-18 22:26 Quote from: munair on June 09, 2025, 10:21:06 amQuote from: wp on June 03, 2025, 11:40:37 pm@munair: Do you want me to add the ProjectMetrics package to OPM? For sure. Sorry for the delay, I missed this response... The package now is available via OPM. ---------------------------------------------------------------------- Nicole · 2025-07-21 11:37 Thank you so much! it is fantastic and that easy to use. Just install and have it. ---------------------------------------------------------------------- munair · 2025-07-23 17:01 Great to hear! ---------------------------------------------------------------------- bobonwhidbey · 2025-12-13 17:51 I know this is an old topic - seemed like the appropriate place for my question. I too am trying to determine how many lines of coding are envolved in a project I've been working on for 35 years!! I installed ProjectMetrics package from the OPM but didn't see how to use it. The attached seems to provide some info - 607k lines.  How can I use ProjectMetrics? ---------------------------------------------------------------------- wp · 2025-12-13 18:13 After you installed the ProjectMetrics package you'll find a new item "Project metrics..." in the "Project" menu of the IDE. Clicking on it will open a form showing the number of code lines, comment lines and empty lines for the currently project loaded in the IDE, as total numbers and separated per project unit. ---------------------------------------------------------------------- bobonwhidbey · 2025-12-13 21:30 Got it.   Thanks