-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add code_count to JSON output #122
Comments
True, this is an unfortunate inconsistency and lapse in the JSON output. Background: I always disliked how SLOC tools count even the most trivial pieces of code that add 0 code complexity. That's why pygount never counts lines that only contain "{" in C or For the same reason, it only reluctantly counts lines that contain nothing but strings. Internally, it collects the following counts, see
The Because I figured that "my" code count might not be popular with everyone, internally there also is:
The For the record, there also is:
To come to a conclusion: Would these two changes resolve your issue?
|
@SeanTConrad If I understand correctly from looking at VerinFast/verinfast#8 you are striving for compatibility with cloc. In that case, the Regardless, pygount's inconsistency with |
@roskakori Thank you. |
Sorry @roskakori . I just realized I didn't respond to your earlier message. If it's the same cost, you could show 3 values for "loc" in both, as you described above. They can be called whatever, as long as it's documented as you said. If I understand you correctly, these are the outputs for "LOC":
For our needs, we are comparing two or more repos for size, complexity, amount of work, etc. I would use "your" measure of code, with it being very important that we are consistent across repos. Thank you! tldr: I agree with you and adding code_count to the json would be great. |
This is not really part of this issue because this is just for fun. But it avoids the overhead of creating a separate issue and branch for such a minor thing.
@SeanTConrad The JSON format finally contains all available counts, and the documentation describes them. I also added #152 for the counts to eventually be consistent across formats. This will be a breaking change and thus only be part of future a version 2.0. |
Story
As user of the JSON format I want...
Goals
code_count
.code_count
andsource_count
.Original request: Format=json summary "totalSourceCount" doesn't match format=summary Code Sum
I apologize if I am missing an option or documentation on this.
I was testing Pygount by running on the public Rails repo:
git clone git@github.com:rails/rails.git
First, I test the summary format with:
pygount -F=.git,node_modules --format=summary rails
The resulting "Sum" for the "Code" column is 382801
Then, I test the JSON output with:
pygount -F=.git,node_modules --format=json -o pygount_test.json rails
The resulting summary at the bottom of the JSON has 410575 for totalSourceCount
{ "summary":{ "totalDocumentationCount":62533, "totalDocumentationPercentage":10.743837150966607, "totalEmptyCount":108928, "totalEmptyPercentage":18.71499357428063, "totalFileCount":4546, "totalSourceCount":410575, "totalSourcePercentage":70.54116927475276 } }
Am I incorrect in expecting the summary format Code Sum and the json format totalSourceCount to match?
Thank you
The text was updated successfully, but these errors were encountered: