• Post Reply Bookmark Topic Watch Topic
  • New Topic

calculating LLOC in code files  RSS feed

 
tom brownlee
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do you go about creating Java classes that calculate and report the number of logical lines of code in a designated source code file???
any help would be good
cheers
tom

 
Shubhrajit Chatterjee
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Open the source file
2. Read line from source
3. Filter for lines which are not logical lines of code ( Comments, Whitespace, braces ...etc)
4. If the line passes all the filters then increment the counter
5. Iterate from step 2 until EOF
It would be good if the filter conditions are configurable through a XML file or a properties file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!