← every case · 2000 · string forms

2062-template_hole_written_over_several_lines

the hole of a JavaScript template literal, from ${ to the } that closes it, is code, and here it runs over three lines. The comment line inside the hole is a real comment. A counter that reads the template as text from one backtick to the next counts that line as part of the string

read ascloc.defaultcloc.docstring-as-codecodestats.defaultmezura.contentmezura.regionscc.defaulttokei.default
input.js
1codeconst s = `a ${
2comments // a comment inside the hole
3code f(x)
4code} b`; /* a real comment
5commentsthat closes on this line */
6codelet y = 1;

stringcommentthe tag around another language

What each tool answered

cloc.default ✓ agrees
the rules ask6 lines · 0 blanks · 4 code · 2 comments
it answers6 lines · 0 blanks · 4 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js

cloc.default ✓ agrees

--strip-str-comments

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

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js --strip-str-comments

cloc.docstring-as-code ✓ agrees
the rules ask6 lines · 0 blanks · 4 code · 2 comments
it answers6 lines · 0 blanks · 4 code · 2 comments

cloc --json --config /tmp/linejudge-empty-file cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js --docstring-as-code

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

codestats cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js --output json-compact --include-generated --no-gitignore --hidden --no-config

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

mezura cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js --output json --hide timing --no-default-config --no-local --counting content

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

mezura cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js --output json --hide timing --no-default-config --no-local --counting region

scc.default ✗ fails

the template is read as text from one backtick to the next, hole included, so the comment line inside the hole counts as code. With that line taken out the file is counted right

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

scc --format json --no-config cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js

tokei.default ✗ fails

the template is read as text from one backtick to the next, hole included, so the comment line inside the hole counts as code. With that line taken out the file is counted right

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

tokei --output json cases/2000-string_forms/2062-template_hole_written_over_several_lines/input.js