← every case · 2000 · string forms

2080-odd_triple_quote_count

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

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.py
1codea = """one"""
2codeb = """two
3codestill inside the docstring
4code# not a comment, still inside the string
5code"""
6comments# a real comment

stringcommentthe tag around another language

What each tool answered

cloc.default ✗ fails

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

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 2 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py

cloc.default ✗ fails

--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

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 2 code · 4 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py --strip-str-comments

cloc.docstring-as-code ✗ fails

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

the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 4 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2080-odd_triple_quote_count/input.py --docstring-as-code

codestats.default ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

codestats cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json-compact --include-generated --no-gitignore --hidden --no-config

mezura.content ✓ agrees
the rules ask6 lines · 5 code · 1 comments · 0 extra
it answers6 lines · 5 code · 1 comments · 0 extra

mezura cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json --hide timing --no-default-config --no-local --counting content

mezura.region ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

mezura cases/2000-string_forms/2080-odd_triple_quote_count/input.py --output json --hide timing --no-default-config --no-local --counting region

scc.default ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

scc --format json --no-config cases/2000-string_forms/2080-odd_triple_quote_count/input.py

tokei.default ✓ agrees
the rules ask6 lines · 0 blanks · 5 code · 1 comments
it answers6 lines · 0 blanks · 5 code · 1 comments

tokei --output json cases/2000-string_forms/2080-odd_triple_quote_count/input.py