← every case · 2000 · string forms
the # inside the docstring is text and not a comment symbol, and the docstring around it is a triple quoted string like any other, opening a line on its own. Case 2100 is the same shape where the block is data the program prints, and the two together separate a counter that decides by where the block sits from one that decides by what it is
| 1 | codecodecodecodecodecode | def f(): |
| 2 | commentscodecodecodecommentscode | """ |
| 3 | commentscodecodecodecommentscode | # this is not a comment, it is inside the docstring |
| 4 | commentscodecodecodecommentscode | """ |
| 5 | codecodecodecodecodecode | return 1 |
stringcommentthe tag around another language
cloc --json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py
--strip-str-comments
cloc --json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/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 cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py --docstring-as-code
mezura cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py --output json --hide timing --no-default-config --no-local --counting region
any triple quoted block that opens a line is read as documentation, so the three lines of this one are comments by the definition it declares and not by a mistake
scc --format json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py
tokei --output json cases/2000-string_forms/2090-docstring_holding_a_comment_symbol/input.py