← every case · 2000 · string forms
an apostrophe inside the body of a shell heredoc. The word that ends a heredoc is chosen where it is written, so no fixed list of comment and string symbols can say what closes this one. The body holds a line beginning with #, so a counter that does not read heredocs counts that line as a comment, unless the apostrophe has opened a string that runs on, and then it counts the comments at the end as code
| 1 | codecodecodecodecodecodecode | cat <<TEXT |
| 2 | codecodecodecodecodecodecode | it's fine in here |
| 3 | codecodecodecodecodecodecode | # and this line is inside the heredoc too |
| 4 | codecodecodecodecodecodecode | TEXT |
| 5 | commentscommentscommentscommentscommentscommentscomments | # a real comment |
| 6 | commentscommentscommentscommentscommentscommentscomments | # a second real comment |
stringcommentthe tag around another language
it reads no heredocs, so the line beginning with # inside one counts as a comment
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh
--strip-str-comments
it reads no heredocs, so the line beginning with # inside one counts as a comment
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh --strip-str-comments
it reads no heredocs, so the line beginning with # inside one counts as a comment
cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh --docstring-as-code
codestats cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh --output json-compact --include-generated --no-gitignore --hidden --no-config
mezura cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh --output json --hide timing --no-default-config --no-local --counting content
mezura cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh --output json --hide timing --no-default-config --no-local --counting region
it reads no heredocs, so the apostrophe opens a string and every line under it is counted as code. Without the apostrophe the line beginning with # inside the heredoc counts as a comment
scc --format json --no-config cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh
it reads no heredocs, so the apostrophe opens a string and every line under it is counted as code. Without the apostrophe the line beginning with # inside the heredoc counts as a comment
tokei --output json cases/2000-string_forms/2120-heredoc_holding_an_apostrophe/input.sh