As a hobby project and as a learning exercise, I decided to implement a software lines of code measurement script in Python.
However, I have a question:
- Are comments included in the measurement?
- The approach I have followed is: open the file, read it from start to end, count the number of lines. If comments are to be ignored, skip that line, else continue and increment counter. Is this how it is done?
Please note that I am aware many tools exist out there and perhaps better than mine, (sloccount
is one example), however I am doing this as a completely hobbyist program.