← 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

read ascloc.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.py
1codea = """one"""
2codeb = """two
3codestill inside the docstring
4code"""
5comments# 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 ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 2 code · 3 comments

cloc --json cases/2000-string_forms/2080-odd_triple_quote_count/input.py

mezura.content ✓ agrees
the rules ask5 lines · 4 code · 1 comments · 0 extra
it answers5 lines · 4 code · 1 comments · 0 extra

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

mezura.region ✓ agrees
the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

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

scc.default ✓ agrees
the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

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

tokei.default ✓ agrees
the rules ask5 lines · 0 blanks · 4 code · 1 comments
it answers5 lines · 0 blanks · 4 code · 1 comments

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