Recent

Author Topic: project - count source lines  (Read 4402 times)

Nicole

  • Hero Member
  • *****
  • Posts: 1271
project - count source lines
« on: May 08, 2025, 07:13:02 pm »
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

  • Hero Member
  • *****
  • Posts: 2463
    • http://www.cdbc.dk
Re: project - count source lines
« Reply #1 on: May 08, 2025, 07:24:48 pm »
Hi Nicole
When I compile a project, fpc shows me how many lines it compiled in the message-window...
See attachment.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6 -> FPC 3.2.2 -> Lazarus 4.0 up until Jan 2025 from then on it's both above &: KDE6/QT6 -> FPC 3.3.1 -> Lazarus 4.99

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11793
  • Debugger - SynEdit - and more
    • wiki
Re: project - count source lines
« Reply #2 on: May 08, 2025, 08:19:12 pm »
The "Code browser" from the View menu shows some stats in its status line.

Set the "Search scope" to project.

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: project - count source lines
« Reply #3 on: May 08, 2025, 09:09:51 pm »
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

  • Hero Member
  • *****
  • Posts: 2463
    • http://www.cdbc.dk
Re: project - count source lines
« Reply #4 on: May 08, 2025, 09:38:50 pm »
Hi
'View' is #4 and 'CodeBrowser' is #7 down...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6 -> FPC 3.2.2 -> Lazarus 4.0 up until Jan 2025 from then on it's both above &: KDE6/QT6 -> FPC 3.3.1 -> Lazarus 4.99

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: project - count source lines
« Reply #5 on: May 09, 2025, 01:03:18 pm »
thank you! Found it.

munair

  • Hero Member
  • *****
  • Posts: 887
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: project - count source lines
« Reply #6 on: May 09, 2025, 10:49:07 pm »
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
It's only logical.

munair

  • Hero Member
  • *****
  • Posts: 887
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: project - count source lines
« Reply #7 on: May 09, 2025, 10:58:46 pm »
The "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).
It's only logical.

munair

  • Hero Member
  • *****
  • Posts: 887
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: project - count source lines
« Reply #8 on: May 15, 2025, 10:09:39 am »
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
« Last Edit: June 09, 2025, 10:23:01 am by munair »
It's only logical.

wp

  • Hero Member
  • *****
  • Posts: 13199
Re: project - count source lines
« Reply #9 on: June 03, 2025, 11:40:37 pm »
@munair: Do you want me to add the ProjectMetrics package to OPM?

Nicole

  • Hero Member
  • *****
  • Posts: 1271
Re: project - count source lines
« Reply #10 on: June 04, 2025, 04:00:23 pm »
Yes, this would be great! I'll wait for it and then take it.

munair

  • Hero Member
  • *****
  • Posts: 887
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: project - count source lines
« Reply #11 on: June 09, 2025, 10:21:06 am »
@munair: Do you want me to add the ProjectMetrics package to OPM?
For sure.
It's only logical.

munair

  • Hero Member
  • *****
  • Posts: 887
  • compiler developer @SharpBASIC
    • SharpBASIC
Re: project - count source lines
« Reply #12 on: June 09, 2025, 10:23:55 am »
wp added some enhancements:
https://github.com/ssgeos/ProjectMetrics
It's only logical.

wp

  • Hero Member
  • *****
  • Posts: 13199
Re: project - count source lines
« Reply #13 on: July 19, 2025, 12:26:10 am »
@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

  • Hero Member
  • *****
  • Posts: 1271
Re: project - count source lines
« Reply #14 on: July 21, 2025, 01:37:42 pm »
Thank you so much!

it is fantastic and that easy to use.
Just install and have it.

 

TinyPortal © 2005-2018