Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Committes: How to count lines of code in a contribution

Dear Committers,
 
Here's a message due to a recent incident:
part of our due diligence when accepting a community contribution is filing the tm-log.csv IP log, which also asks for a lines of code number in the contribution.
 
How to count lines of code most easily, and correctly?
You might want to consider using my "lcp" script to count lines in a patch:
http://www.eclipse.org/dsdp/tm/development/committer_howto.php#sloccount

It counts the "+" added lines only and subtracts empty lines as well as lines that only have a comment.

You're right that removing lines also constitutes an act of creativity so even a patch that ONLY removes lines is valuable. But for the application in our tm-log.csv it's more important to count how much new copyrightable stuff comes
in through the patch. And that is comprised of the "+" lines only.

The script is still not perfect in the case where existing code is only moved to a different place (leading to lots of + along with the same number of - lines, which also constitutes creativity but not necessarily new copyrightable
stuff). But finding out such moves is beyond the scope of what we should do when counting lines.
Hope you find this useful,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
 
 

Back to the top