← every case · 2000 · string forms
a triple quoted string opened on one line and closed on another keeps the lines between out of the comment count, since a string is not a comment. One of those lines begins with #, so a counter that ends the string with the line it opens on counts that one as a comment
| 1 | codecodecodecodecodecodecode | a = """one""" |
| 2 | codecodecodecodecodecodecode | b = """two |
| 3 | codecodecodecodecodecodecode | still inside the docstring |
| 4 | codecodecodecodecodecodecode | # not a comment, still inside the string |
| 5 | codecodecodecodecodecodecode | """ |
| 6 | commentscommentscommentscommentscommentscommentscomments | # a real comment |
stringcommentthe tag around another language
a triple quoted string is read as documentation wherever it opens, the middle of a line of code included, so the lines holding its text and its closing quotes are added to the comment count
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py
--strip-str-comments
a triple quoted string is read as documentation wherever it opens, the middle of a line of code included, so the lines holding its text and its closing quotes are added to the comment count
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py --strip-str-comments
the flag makes cloc skip the stage that turns a docstring into a comment, so nothing tells the filters below that those lines are inside anything, and the one whose first mark is a # is dropped as a comment line
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py --docstring-as-code
codestats cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json --hide timing --no-default-config --no-local --counting region
scc --format json --no-config cases/2000-string_forms/2080-odd_triple_quote_count/input.py
tokei --output json cases/2000-string_forms/2080-odd_triple_quote_count/input.py