-
Notifications
You must be signed in to change notification settings - Fork 119
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
Incorrect lloc count #262
Comments
Confirmed, and you have identified the right reason. A simple (but not perfect) fix would be to, besides checking for a colon, also check for a compound statement keyword on the line. That would fix the provided example. So instead of: Line 163 in 3b75f79
We'd have something like(untested): # Only consider colons when a compound statement is found in the line
if any(token.string in COMPOUND_KEYWORDS for token in processed):
return 2 - (token_pos == len(processed) - 2)
return 1 Where COMPOUND_KEYWORDS = {"if", "while", "for", "try", "with", "match", "def", "class", "else", "elif", "except", "finally", "case"} That still leaves at least one issue: both case = {1: 2}
match = {3: 4} It seems that a line with a soft keyword Edited to add: It would also be necessary to decide on how to treat def a(b=lambda x: 1):
pass |
I've added a PR to fix this, #263. It doesn't consider |
I'm getting incorrect lloc count, when a dictionary is in the code.
I'm calculating lloc of this function with this below command :-
'radon raw 'path' -s'
Result:-
LOC: 4
LLOC: 5
SLOC: 4
Comments: 0
Single comments: 0
Multi: 0
Blank: 0
- Comment Stats
(C % L): 0%
(C % S): 0%
(C + M % L): 0%
In this result lloc is incorrect , there is only 4 lloc. If I remove the dictionary, then the lloc will be correct. I think, here the issue is colon is present in the dictionary.
The text was updated successfully, but these errors were encountered: