Recent

Author Topic: [SOLVED] Code metrics for Lazarus FPC - number of code lines  (Read 2600 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
[SOLVED] Code metrics for Lazarus FPC - number of code lines
« on: November 09, 2017, 03:34:00 pm »
hi All,
please advise if there is an option in Lazarus IDE to provide information on the number of code lines for the files in project (i think the ones in the project folder could be considered only).
i did not find it in version 1.8RC5 but is there maybe in trunk?

i am developing on Windows and the feature could come handy.
thank you
« Last Edit: November 09, 2017, 05:41:47 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Code metrics for Lazarus FPC - number of code lines
« Reply #1 on: November 09, 2017, 04:58:52 pm »
Tools->Options
In IDE Options dialog, under the Environment node click on Messages Window, and in the page that is shown make sure that Show FPC message "lines compiled" is checked.

Note this is just a crude line count of the project. It includes blank lines and comments, compiler directives etc., so the number of lines contributing to compiled code will be smaller.
But the number of "code" lines is in any case an ambiguous quantity. Consider these identical programs:
Code: Pascal  [Select][+][-]
  1. program
  2. project1
  3. ;
  4.  
  5. begin
  6.   Writeln
  7.   (
  8.   'This is a test'
  9.   )
  10.   ;
  11.  
  12.  
  13.   Readln
  14.   ;
  15.  
  16. end.
17 lines

Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. begin
  4.   Writeln('This is a test');
  5.   Readln;
  6. end.
7 lines

Code: Pascal  [Select][+][-]
  1. program project1; begin Writeln('This is a test'); Readln; end.
1 line
« Last Edit: November 09, 2017, 05:22:25 pm by howardpc »

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Code metrics for Lazarus FPC - number of code lines
« Reply #2 on: November 09, 2017, 05:41:32 pm »
thank you!
Lazarus 2.0.2 64b on Debian LXDE 10

 

TinyPortal © 2005-2018