From 6568799601a1ff011ee5c9bb225bf8ae6270cf50 Mon Sep 17 00:00:00 2001
From: Yasunobu <42543015+P4suta@users.noreply.github.com>
Date: Sat, 26 Sep 2026 01:19:13 +0900
Subject: [PATCH] fix(markdown): remove a fence's indentation before scanning
its body
CommonMark takes up to as many spaces as a fenced code block's opener is indented off each line of the block's content.
The scanner handed the body to the embedded language with that indentation still on, so a heredoc terminator written at the fence's indentation, as under a list item, was not one, and the page was reported as invalid syntax with exit status 2.
The Rust scanner now scans an indented fence's body over a de-indented MappedBytes copy, keeping the child's offset, and maps every comment and diagnostic span back to the bytes on the page, so fix edits the right bytes.
A tab that crosses the opener's column leaves the rest of its width as spaces, which is what `commonmark` 0.31.2 and `markdown-it` 15.0.2 both do.
The OCaml reference applies the same rule over its own mapped_bytes.
Three fixtures record what CommonMark and bash do with such a block: an indented fence at the top level, one under a list item, and a tab in the indentation.
---
CHANGELOG.md | 5 +
ocaml/lib/ocomment_ref.ml | 54 ++++++--
ocaml/test/test_core.ml | 15 +++
rust/ocomment-core/src/scanner.rs | 151 +++++++++++++++++++---
rust/ocomment-core/tests/languages.rs | 74 +++++++++++
rust/ocomment/assets/selftest-corpus.json | 2 +-
rust/ocomment/tests/cli.rs | 24 ++++
spec/fixtures/v1/floor.txt | 4 +-
spec/fixtures/v1/hazards.json | 72 +++++++++++
9 files changed, 367 insertions(+), 34 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cd791b..8f4551a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -55,6 +55,11 @@ All notable changes to OComment will be documented here. The project follows
### Fixed
+- A fenced code block indented under a list item is read the way CommonMark reads it.
+ Up to as many spaces as the opening fence is indented come off each line of the body, and a tab that crosses that column leaves the rest of its width as spaces.
+ The body was scanned with the indentation still on, so a heredoc terminator written at the fence's indentation was not one, and the page was reported as invalid syntax with exit status 2.
+ Spans still name the bytes on the page, so `fix` removes a comment in such a block where it stands.
+
- A mise file task's header is a load-bearing directive in every language.
mise and its `usage` library read `#MISE`, `#USAGE`, `#[MISE]` and `#[USAGE]` — and the same after `//` — case-sensitively from the raw line, and `#MISE depends=`, `dir=` and `#USAGE flag` decide what the task runs and which arguments it accepts.
They were read as prose, so `ocomment fix --tidy` under `wrap = "sentence"` joined a `#MISE` line and the `#USAGE flag` line under it into one `# MISE` line, and the task stopped declaring the flag.
diff --git a/ocaml/lib/ocomment_ref.ml b/ocaml/lib/ocomment_ref.ml
index 1fa3c89..4238ec4 100644
--- a/ocaml/lib/ocomment_ref.ml
+++ b/ocaml/lib/ocomment_ref.ml
@@ -938,6 +938,37 @@ let without_c_line_splices source =
{ mapped = Bytes.of_string (Buffer.contents buffer);
origins = Array.of_list (List.rev !origins); original_length = Bytes.length source }
+(** The body of a fenced code block whose opener is indented [indent] columns, with up to that many columns taken off the start of each line (CommonMark 4.5).
+ The body starts at the line break that ends the opener, so its first line is not a line of the block and keeps what it has.
+ A tab reaches the next multiple of four (CommonMark 2.2); when it crosses [indent] it is replaced by the spaces that remain past [indent], each of which maps back to the tab. *)
+let without_fence_indentation source indent =
+ let length = Bytes.length source in
+ let buffer = Buffer.create length and origins = ref [] in
+ let keep character origin =
+ Buffer.add_char buffer character;
+ origins := { start = origin; finish = origin + 1 } :: !origins in
+ let rec strip index column =
+ if column >= indent || index >= length then index
+ else match Bytes.get source index with
+ | ' ' -> strip (index + 1) (column + 1)
+ | '\t' ->
+ let stop = (column / 4 + 1) * 4 in
+ for _ = 1 to stop - indent do keep ' ' index done;
+ strip (index + 1) stop
+ | _ -> index in
+ let rec copy index =
+ if index < length then begin
+ let character = Bytes.get source index in
+ keep character index;
+ let next = index + 1 in
+ let ends_line = character = '\n'
+ || (character = '\r' && (next >= length || Bytes.get source next <> '\n')) in
+ copy (if ends_line then strip next 0 else next)
+ end in
+ copy 0;
+ { mapped = Bytes.of_string (Buffer.contents buffer);
+ origins = Array.of_list (List.rev !origins); original_length = length }
+
let hex_digit = function
| '0' .. '9' as value -> Some (Char.code value - Char.code '0')
| 'a' .. 'f' as value -> Some (Char.code value - Char.code 'a' + 10)
@@ -4953,7 +4984,7 @@ let vue_style_language lang =
}" opens an expression. *)
(** One Markdown document.
- An HTML comment is a comment, a fenced code block is scanned as the language its info string names, and a code span or indented block is opaque.
+ An HTML comment is a comment, a fenced code block is scanned as the language its info string names, over its lines with the opener's indentation taken off each, and a code span or indented block is opaque.
Every construct is recognised at its own start and read forward, so no decision depends on a byte behind a restart. *)
(** One Perl document.
@@ -5311,7 +5342,7 @@ let scan_markdown source language options accumulator =
if word = "" then None else match language_of_string word with
| Ok found -> Some found
| Error _ -> None in
- let fence opener marker run =
+ let fence opener marker run columns =
let info_start = opener + run in
let info_finish = line_end source info_start in
let embedded = fence_language
@@ -5346,7 +5377,9 @@ let scan_markdown source language options accumulator =
(match embedded with
| Some (Html | Markdown | Vue | Svelte | Unknown) | None -> ()
| Some embedded ->
- let child_source = Bytes.sub source info_finish (content_finish - info_finish) in
+ let mapping = without_fence_indentation
+ (Bytes.sub source info_finish (content_finish - info_finish)) columns in
+ let child_source = mapping.mapped in
let child = { comments_rev = []; diagnostics_rev = []; yaml_blocks_rev = [] } in
(match embedded with
| Css when options.dialect = Sass -> scan_sass child_source embedded options child
@@ -5370,15 +5403,16 @@ let scan_markdown source language options accumulator =
| R -> scan_r child_source embedded options child
| Perl -> scan_perl child_source embedded options child
| Html | Markdown | Vue | Svelte | Unknown -> ());
+ let place span =
+ let span = mapped_span mapping span in
+ { start = span.start + info_finish; finish = span.finish + info_finish } in
List.iter (fun (comment : comment) ->
- accumulator.comments_rev <- { comment with span = {
- start = comment.span.start + info_finish;
- finish = comment.span.finish + info_finish } } :: accumulator.comments_rev)
+ accumulator.comments_rev <- { comment with span = place comment.span }
+ :: accumulator.comments_rev)
(List.rev child.comments_rev);
List.iter (fun (diagnostic : diagnostic) ->
- accumulator.diagnostics_rev <- { diagnostic with span = {
- start = diagnostic.span.start + info_finish;
- finish = diagnostic.span.finish + info_finish } } :: accumulator.diagnostics_rev)
+ accumulator.diagnostics_rev <- { diagnostic with span = place diagnostic.span }
+ :: accumulator.diagnostics_rev)
(List.rev child.diagnostics_rev));
match closer with Some (_, resume) -> resume | None -> length in
let indented start =
@@ -5407,7 +5441,7 @@ let scan_markdown source language options accumulator =
let valid_info = marker <> '`'
|| not (String.contains
(Bytes.sub_string source (cursor + run) (info_finish - cursor - run)) '`') in
- if run >= 3 && valid_info then loop (fence cursor marker run)
+ if run >= 3 && valid_info then loop (fence cursor marker run columns)
else if marker = '`' then loop (inline_code_end cursor)
else loop (index + 1)
end else if Bytes.get source index = '`' then loop (inline_code_end index)
diff --git a/ocaml/test/test_core.ml b/ocaml/test/test_core.ml
index 72174c4..a03b9ab 100644
--- a/ocaml/test/test_core.ml
+++ b/ocaml/test/test_core.ml
@@ -321,6 +321,20 @@ let check_markdown_commonmark_boundaries () =
Alcotest.(check (list string)) "markdown comments"
["# r comment"; ""] (raw_comments source report)
+(* NOTE: A fence indented N spaces is read with up to N spaces off each line of its body, so the EOF under a list item ends the heredoc; a span still covers the page, indentation between its lines included. *)
+let check_markdown_indented_fence () =
+ let shell = Bytes.of_string
+ "1. Step:\n\n ```sh\n cat <<'EOF'\n # heredoc text\n EOF\n echo done # remove\n ```\n" in
+ let report = scan shell Markdown default_scan_options in
+ Alcotest.(check bool) "heredoc under a list item valid" true report.valid;
+ Alcotest.(check (list string)) "only the comment after the heredoc"
+ ["# remove"] (raw_comments shell report);
+ let block = Bytes.of_string
+ "1. Build:\n\n ```c\n /* one\n two */\n int x;\n ```\n" in
+ let report = scan block Markdown default_scan_options in
+ Alcotest.(check (list string)) "block comment over the page"
+ ["/* one\n two */"] (raw_comments block report)
+
let check_perl_compound_opaque_constructs () =
let source = Bytes.of_string
"print $#items, $^X, $!, $1; # variables\nmy $q = \"escaped \\\" # opaque\"; # quote\n$x =~ s/foo#one/bar#two/g; # substitution\n$x =~ tr/a#b/c#d/; # transliteration\nprint << \"ONE\", <<~'TWO';\n# first\nONE\n # second\n TWO\n=pod\n# pod\n=cutlery\n# still pod\n=cut\nformat STDOUT =\n@<<<<\n# picture\n.\n# after format\n__DATA__\n# data\n" in
@@ -415,6 +429,7 @@ let () = Alcotest.run "ocomment-ref" [
Alcotest.test_case "kotlin-multi-dollar" `Quick check_kotlin_multi_dollar_and_quote_runs;
Alcotest.test_case "scala-characters" `Quick check_scala_characters_and_symbols;
Alcotest.test_case "markdown-commonmark" `Quick check_markdown_commonmark_boundaries;
+ Alcotest.test_case "markdown-indented-fence" `Quick check_markdown_indented_fence;
Alcotest.test_case "perl-compounds" `Quick check_perl_compound_opaque_constructs;
Alcotest.test_case "sfc-attributes-and-sass" `Quick check_sfc_exact_attributes_and_sass;
Alcotest.test_case "span-bounds" `Quick check_all_spans_are_bounded;
diff --git a/rust/ocomment-core/src/scanner.rs b/rust/ocomment-core/src/scanner.rs
index 9609a35..cbeff1a 100644
--- a/rust/ocomment-core/src/scanner.rs
+++ b/rust/ocomment-core/src/scanner.rs
@@ -1012,7 +1012,7 @@ impl<'a> Scanner<'a> {
0,
);
child.scan_c_family_unmapped();
- self.merge_mapped(child, &mapped);
+ self.merge_mapped(child, &mapped, 0);
} else {
self.scan_c_family_unmapped();
}
@@ -1683,20 +1683,28 @@ impl<'a> Scanner<'a> {
}
index += 1;
}
- self.merge_mapped(child, &mapped);
+ self.merge_mapped(child, &mapped, 0);
}
- fn merge_mapped(&mut self, child: Scanner<'_>, mapped: &MappedBytes) {
+ /// Fold in a child that scanned `mapped`, a remapped copy of this source from `origin` on.
+ /// The child reports spans in the copy's coordinates shifted by its own offset, and each comes back as the original bytes it was read from.
+ fn merge_mapped(&mut self, child: Scanner<'_>, mapped: &MappedBytes, origin: usize) {
+ let shift = child.offset;
+ let base = self.offset + origin;
+ let place = |span: ByteSpan| {
+ let copied = ByteSpan::new(
+ span.start.saturating_sub(shift),
+ span.end.saturating_sub(shift),
+ );
+ let original = mapped.original_span(copied);
+ ByteSpan::new(original.start + base, original.end + base)
+ };
for mut comment in child.comments {
- comment.span = mapped.original_span(comment.span);
- comment.span.start += self.offset;
- comment.span.end += self.offset;
+ comment.span = place(comment.span);
self.comments.push(comment);
}
for mut diagnostic in child.diagnostics {
- diagnostic.span = mapped.original_span(diagnostic.span);
- diagnostic.span.start += self.offset;
- diagnostic.span.end += self.offset;
+ diagnostic.span = place(diagnostic.span);
self.diagnostics.push(diagnostic);
}
}
@@ -5633,7 +5641,7 @@ impl<'a> Scanner<'a> {
let valid_info =
marker != b'`' || !bytes[cursor + run..info_end].contains(&b'`');
if run >= 3 && valid_info {
- index = self.scan_markdown_fence(cursor, marker, run);
+ index = self.scan_markdown_fence(cursor, marker, run, indent);
continue;
}
}
@@ -5653,9 +5661,18 @@ impl<'a> Scanner<'a> {
}
}
- /// One fenced code block, beginning at its opening run of backticks or tildes.
+ /// One fenced code block, beginning at its opening run of backticks or tildes, which stands `indent` columns in.
/// The body is scanned as the language its info string names, or as nothing when the string names none; the block ends at a line of the same marker with a run at least as long as the opener's, and a block that never closes is a file CommonMark reads to its end, so the rest of the document is opaque.
- fn scan_markdown_fence(&mut self, opener: usize, marker: u8, run: usize) -> usize {
+ ///
+ /// An indented opener takes up to as much indentation off every line of the body, per CommonMark 4.5, and the body is scanned as those lines rather than as the bytes on the page: a heredoc terminator written at the fence's indentation under a list item is at the start of its line.
+ /// The spans come back to the page through [`MappedBytes`].
+ fn scan_markdown_fence(
+ &mut self,
+ opener: usize,
+ marker: u8,
+ run: usize,
+ indent: usize,
+ ) -> usize {
let bytes = self.source;
let info_start = opener + run;
let info_end = line_end(bytes, info_start);
@@ -5696,15 +5713,29 @@ impl<'a> Scanner<'a> {
Language::Html | Language::Vue | Language::Svelte | Language::Markdown
)
{
- let mut child = Scanner::child(
- &bytes[info_end..content_end],
- language,
- self.options.clone(),
- self.patterns.clone(),
- self.offset + info_end,
- );
- child.scan_language();
- self.merge_child(child);
+ let content = &bytes[info_end..content_end];
+ if indent == 0 {
+ let mut child = Scanner::child(
+ content,
+ language,
+ self.options.clone(),
+ self.patterns.clone(),
+ self.offset + info_end,
+ );
+ child.scan_language();
+ self.merge_child(child);
+ } else {
+ let mapped = MappedBytes::without_fence_indentation(content, indent);
+ let mut child = Scanner::child(
+ &mapped.bytes,
+ language,
+ self.options.clone(),
+ self.patterns.clone(),
+ self.offset + info_end,
+ );
+ child.scan_language();
+ self.merge_mapped(child, &mapped, info_end);
+ }
}
closer.map_or(bytes.len(), |(_, resume)| resume)
}
@@ -10680,6 +10711,50 @@ impl MappedBytes {
}
}
+ /// The body of a fenced code block whose opener stands `indent` columns in, as CommonMark 4.5 hands it on: up to `indent` columns of indentation come off the start of every line.
+ ///
+ /// `content` begins at the line terminator that ends the opener, so its first line is the empty rest of that one and loses nothing.
+ /// A tab counts to the next multiple of four, per CommonMark 2.2, and one that runs past `indent` is taken off and the columns it had left are put back as spaces — `commonmark` 0.31.2 and `markdown-it` 15.0.2 both read `\tEOF` under a three-space opener as ` EOF`.
+ /// Each of those spaces maps back to the tab.
+ fn without_fence_indentation(content: &[u8], indent: usize) -> Self {
+ let mut bytes = Vec::with_capacity(content.len());
+ let mut origins = Vec::with_capacity(content.len());
+ let mut index = 0;
+ let mut line_start = false;
+ while index < content.len() {
+ if line_start {
+ line_start = false;
+ let mut column = 0;
+ while column < indent && index < content.len() {
+ match content[index] {
+ b' ' => column += 1,
+ b'\t' => {
+ let stop = column + 4 - column % 4;
+ for _ in indent..stop {
+ bytes.push(b' ');
+ origins.push(ByteSpan::new(index, index + 1));
+ }
+ column = stop;
+ }
+ _ => break,
+ }
+ index += 1;
+ }
+ continue;
+ }
+ let byte = content[index];
+ bytes.push(byte);
+ origins.push(ByteSpan::new(index, index + 1));
+ index += 1;
+ line_start = byte == b'\n' || (byte == b'\r' && content.get(index) != Some(&b'\n'));
+ }
+ Self {
+ bytes,
+ origins,
+ original_len: content.len(),
+ }
+ }
+
fn java_unicode(source: &[u8]) -> (Self, Vec # html # html # html # html {x /* c */} {x } a b a b #not a comment
kept
\n","expect":{"valid":true,"comments":[{"start":6,"end":16,"kind":"line","action":"remove"}],"output_utf8":"kept
\n"}},{"id":"php-close-tag-swallows-newline","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n#!/usr/bin/env php\n\n#!/usr/bin/env php\n not html\"; $b = '?>'; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":" not html\"; $b = '?>'; \n"}},{"id":"php-shebang","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env php\n\r\nx
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":13,"kind":"line","action":"remove"},{"start":15,"end":32,"kind":"block","action":"remove"}],"output_utf8":"\r\nx
\r\n"}},{"id":"php-unterminated-heredoc","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"() {} // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":24,"kind":"line","action":"remove"}]}},{"id":"rust-unicode-loop-label","language":"rust","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"'ä: loop { break 'ä } // remove\n","expect":{"valid":true,"comments":[{"start":24,"end":33,"kind":"line","action":"remove"}]}},{"id":"ocaml-char-literal-across-newline","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = '\n' (* remove *)\nlet b = '\\\n' (* remove *)\n","expect":{"valid":true,"comments":[{"start":12,"end":24,"kind":"block","action":"remove"},{"start":38,"end":50,"kind":"block","action":"remove"}],"output_utf8":"let a = '\n' \nlet b = '\\\n' \n"}},{"id":"ruby-alias-percent-s","language":"ruby","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"alias%s(baz # x) %s(bar)\nputs 1 # remove\n","expect":{"valid":true,"comments":[{"start":32,"end":40,"kind":"line","action":"remove"}],"output_utf8":"alias%s(baz # x) %s(bar)\nputs 1 \n"}},{"id":"bom-shebang-dart","language":"dart","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAK"}},{"id":"swift-nested-block-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nlet a = 1 // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":35,"kind":"block","action":"remove"},{"start":46,"end":55,"kind":"line","action":"remove"}],"output_utf8":"\nlet a = 1 \n"}},{"id":"swift-doc-forms","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not swift\n/** doc */\n/*! bang */\n/**/\n/***/\n// line\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"doc-line","action":"remove"},{"start":18,"end":31,"kind":"line","action":"remove"},{"start":32,"end":42,"kind":"doc-block","action":"remove"},{"start":43,"end":54,"kind":"block","action":"remove"},{"start":55,"end":59,"kind":"block","action":"remove"},{"start":60,"end":65,"kind":"doc-block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\nlet a = 1\n"}},{"id":"swift-interpolation-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"v: \\( 1 /* c */ + 2 )\" // remove\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"block","action":"remove"},{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"let a = \"v: \\( 1 + 2 )\" \n"}},{"id":"swift-multiline-string","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\n// not\n\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = \"\"\"\n// not\n\"\"\"\n\n"}},{"id":"swift-raw-string-hashes","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = ##\"a \"# // not\"##\n// remove\n","expect":{"valid":true,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = ##\"a \"# // not\"##\n\n"}},{"id":"swift-raw-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":30,"end":39,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n\n"}},{"id":"swift-raw-interpolation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"v: \\#( 1 /* c */ ) and \\(1)\"# // remove\n","expect":{"valid":true,"comments":[{"start":19,"end":26,"kind":"block","action":"remove"},{"start":41,"end":50,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"v: \\#( 1 ) and \\(1)\"# \n"}},{"id":"swift-raw-quote-only","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"#\n\n"}},{"id":"swift-string-pound-boundary","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 \n"}},{"id":"swift-extended-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/https://x/# // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = #/https://x/# \n"}},{"id":"swift-extended-regex-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\n x y\n/#\n// remove\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\n x y\n/#\n\n"}},{"id":"swift-bare-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /a\\//;print(1) // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = /a\\//;print(1) \n"}},{"id":"swift-bare-regex-limitation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = / b\\//\nlet c = 1\n","expect":{"valid":true,"comments":[{"start":12,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = / b\\\nlet c = 1\n"}},{"id":"swift-division-not-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 1 / 2 // remove\nlet b = a/a/a // remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"},{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"let a = 1 / 2 \nlet b = a/a/a \n"}},{"id":"swift-regex-comment-wins","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /x//y/\nlet b = 1\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = /x\nlet b = 1\n"}},{"id":"swift-compiler-directive-not-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG\nlet a = 1 // remove\n#endif\n#warning(\"x // y\")\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG\nlet a = 1 \n#endif\n#warning(\"x // y\")\n"}},{"id":"swift-tools-version-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":27,"end":37,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\n\n"}},{"id":"swift-swiftlint-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swiftlint:disable force_cast\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"directive","action":"keep"},{"start":32,"end":42,"kind":"line","action":"remove"}],"output_utf8":"// swiftlint:disable force_cast\n\n"}},{"id":"swift-format-ignore-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-format-ignore-file\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":27,"kind":"directive","action":"keep"},{"start":28,"end":38,"kind":"line","action":"remove"}],"output_utf8":"// swift-format-ignore-file\n\n"}},{"id":"swift-mark-is-not-a-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// MARK: - Section\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"remove"},{"start":19,"end":29,"kind":"line","action":"remove"}],"output_utf8":"\n\n"}},{"id":"swift-unterminated-nested","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open /* inner */\nlet a = 1\n","expect":{"valid":false,"comments":[{"start":0,"end":30,"kind":"block","action":"remove"}],"output_utf8":"/* open /* inner */\nlet a = 1\n"}},{"id":"swift-unterminated-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\nopen\nlet b = 2\n","expect":{"valid":false,"comments":[],"output_utf8":"let a = \"\"\"\nopen\nlet b = 2\n"}},{"id":"swift-unterminated-extended-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\nopen\nlet b = 2 // remove\n","expect":{"valid":false,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\nopen\nlet b = 2 // remove\n"}},{"id":"swift-single-quoted-recovery","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 'x // not'\n// remove\n","expect":{"valid":true,"comments":[{"start":19,"end":28,"kind":"line","action":"remove"}],"output_utf8":"let a = 'x // not'\n\n"}},{"id":"swift-shebang","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env swift\n// remove\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"shebang","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env swift\n\nlet a = 1\n"}},{"id":"swift-crlf","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":62,"end":71,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n\r\n"}},{"id":"swift-columns","language":"swift","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":" \nlet x = 1 \n"}},{"id":"swift-compact","language":"swift","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":"let x = 1\n"}},{"id":"bom-shebang-javascript","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IC8vIHJlbW92ZQo=","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IAo="}},{"id":"csharp-doc-forms","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not csharp\n/** doc */\n/*! bang */\n/**/\n/***/\n/*** three */\n// line\nclass C { }\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"line","action":"remove"},{"start":18,"end":32,"kind":"line","action":"remove"},{"start":33,"end":43,"kind":"doc-block","action":"remove"},{"start":44,"end":55,"kind":"block","action":"remove"},{"start":56,"end":60,"kind":"block","action":"remove"},{"start":61,"end":66,"kind":"block","action":"remove"},{"start":67,"end":80,"kind":"block","action":"remove"},{"start":81,"end":88,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\n\nclass C { }\n"}},{"id":"csharp-non-nested-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"remove"},{"start":47,"end":56,"kind":"line","action":"remove"}],"output_utf8":" still outer */\nvar a = 1; \n"}},{"id":"csharp-verbatim-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"quote \"\" inside // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"quote \"\" inside // no\"; \n"}},{"id":"csharp-verbatim-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"first // no\nsecond */ no\"; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"first // no\nsecond */ no\"; \n"}},{"id":"csharp-verbatim-identifier","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var @class = 1; // remove\n","expect":{"valid":true,"comments":[{"start":16,"end":25,"kind":"line","action":"remove"}],"output_utf8":"var @class = 1; \n"}},{"id":"csharp-interpolated-braces-escape","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{{literal}} // no {x} tail\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{{literal}} // no {x} tail\"; \n"}},{"id":"csharp-interpolated-hole-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x /* hole */} // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":25,"kind":"block","action":"remove"},{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x } // no\"; \n"}},{"id":"csharp-interpolated-hole-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x // hole\n}\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":22,"kind":"line","action":"remove"},{"start":27,"end":36,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x \n}\"; \n"}},{"id":"csharp-interpolated-format-clause","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{x:D4 // no}\"; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{x:D4 // no}\"; \n"}},{"id":"csharp-verbatim-interpolated","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; // remove\n","expect":{"valid":true,"comments":[{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; \n"}},{"id":"csharp-raw-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; \n"}},{"id":"csharp-raw-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\n body // no\n \"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\n body // no\n \"\"\"; \n"}},{"id":"csharp-raw-interpolated-dollar","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $$\"\"\"{not a hole} {{x /* hole */}} // no\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":30,"end":40,"kind":"block","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"var s = $$\"\"\"{not a hole} {{x }} // no\"\"\"; \n"}},{"id":"csharp-utf8-literal","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"bytes // no\"u8; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = \"bytes // no\"u8; \n"}},{"id":"csharp-string-escape-carries-a-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"a\\\nb // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var s = \"a\\\nb // no\"; \n"}},{"id":"csharp-character-literals","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"char a = '/'; char b = '\\''; char c = '\"'; // remove\n","expect":{"valid":true,"comments":[{"start":43,"end":52,"kind":"line","action":"remove"}],"output_utf8":"char a = '/'; char b = '\\''; char c = '\"'; \n"}},{"id":"csharp-preprocessor-if-with-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG // kept\nvar a = 1; // remove\n#endif // tail\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"},{"start":46,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG \nvar a = 1; \n#endif \n"}},{"id":"csharp-region-text-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#region Name // not a comment\n#endregion // a comment\n","expect":{"valid":true,"comments":[{"start":41,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#region Name // not a comment\n#endregion \n"}},{"id":"csharp-pragma-text","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#pragma warning disable 1591 // a comment\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":29,"end":41,"kind":"line","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"#pragma warning disable 1591 \nvar a = 1; \n"}},{"id":"csharp-line-directive-string","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#line 1 \"a//b.cs\" // tail\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"},{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"#line 1 \"a//b.cs\" \nvar a = 1; \n"}},{"id":"csharp-error-message-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#error boom // no\n","expect":{"valid":true,"comments":[],"output_utf8":"#error boom // no\n"}},{"id":"csharp-directive-block-comment-is-not-one","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; \n"}},{"id":"csharp-hash-after-code-is-not-a-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var a = 1; #if X // no\n#endif\n","expect":{"valid":true,"comments":[],"output_utf8":"var a = 1; #if X // no\n#endif\n"}},{"id":"csharp-unicode-line-terminator","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"dmFyIGEgPSAxOyAvLyBj4oCodmFyIGIgPSAyOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"}],"output_base64":"dmFyIGEgPSAxOyDigKh2YXIgYiA9IDI7IAo="}},{"id":"csharp-auto-generated-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//{x // c\n}
\n\n","expect":{"valid":true,"comments":[{"start":6,"end":10,"kind":"line","action":"remove"},{"start":17,"end":30,"kind":"html-comment","action":"keep"}],"output_utf8":"{x \n}
\n\n"}},{"id":"markdown-fences-and-inline-code","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"```nope\n// not a comment\n```\n`// not either`\n /* nor this */\n","expect":{"valid":true,"comments":[]}},{"id":"perl-ambiguous-slash-after-paren","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"sub f { 1 }\nf() /a#b/;\nmy $x = (2) / 2; # division\n","expect":{"valid":false,"comments":[]}},{"id":"perl-compound-opaque-sections","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"my @items = (1);\nprint $#items, $^X; # variables\nmy $q = \"escaped \\\" # opaque\"; # quote\n$x =~ s/foo#one/bar#two/g; # substitution\nprint << \"ONE\", <<~'TWO';\n# first body\nONE\n # second body\n TWO\n=pod\n# pod body\n=cutlery\n# still pod\n=cut\nformat STDOUT =\n@<<<<<<<<\n# picture body\n.\n# after format\n__DATA__\n# data body\n","expect":{"valid":true,"comments":[{"start":37,"end":48,"kind":"line","action":"remove"},{"start":80,"end":87,"kind":"line","action":"remove"},{"start":115,"end":129,"kind":"line","action":"remove"},{"start":281,"end":295,"kind":"line","action":"remove"}]}},{"id":"scss-interpolation-in-string-and-url","language":"css","dialect":"scss","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a { x: \"#{1 /* string */}\"; y: url( \"#{2 /* url */}\" ); z: url(foo\\)bar//opaque); // outer\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":25,"kind":"block","action":"remove"},{"start":42,"end":51,"kind":"block","action":"remove"},{"start":83,"end":91,"kind":"line","action":"remove"}]}},{"id":"sass-silent-comment-indented-body","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a\n // parent\n color: red\n width: 1px\n color: blue\n// root\n nested: yes\n.b\n color: green\n","expect":{"valid":true,"comments":[{"start":5,"end":46,"kind":"line","action":"remove"},{"start":61,"end":82,"kind":"line","action":"remove"}]}},{"id":"vue-exact-attributes-directives-and-nested-v-pre","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"x
\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\nx
\n"}},{"id":"profile-longest-token-wins-over-declaration-order","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"//// module\n/// item\n// remark\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"keep"},{"start":12,"end":20,"kind":"doc-line","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}]}},{"id":"profile-prefix-delimiters-are-not-ambiguous","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"///doc\n//remark\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"keep"},{"start":7,"end":15,"kind":"line","action":"remove"}]}},{"id":"profile-a-string-still-hides-a-comment-token","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"pub const s = \"// not a comment\"\n// a comment\n","expect":{"valid":true,"comments":[{"start":33,"end":45,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-dashes-open-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- a remark\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-an-operator-is-not-a-comment","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a --> b\nc <-- d\n","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"}],"output_utf8":"a --> b\nc <\n"}},{"id":"profile-haskell-a-longer-run-of-dashes-is-still-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"---x is a comment\ny = 2\n","expect":{"valid":true,"comments":[{"start":0,"end":17,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-longer-run-before-a-symbol-is-an-operator","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a ----> b\n","expect":{"valid":true,"comments":[],"output_utf8":"a ----> b\n"}},{"id":"profile-haskell-haddock-continues-with-the-plain-opener","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | The first line is marked.\n-- The rest is not.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"doc-line","action":"keep"},{"start":31,"end":52,"kind":"doc-line","action":"keep"}]}},{"id":"profile-haskell-a-blank-line-ends-the-continuation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\n\n-- an unrelated remark\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":21,"end":43,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-remark-below-code-is-not-documentation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\nadd = 1\n-- an unrelated remark\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":28,"end":50,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-nesting-counts-the-pairing","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n","expect":{"valid":true,"comments":[{"start":0,"end":58,"kind":"doc-block","action":"keep"}],"output_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n"}},{"id":"profile-haskell-a-string-hides-both-comment-forms","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"s = \"-- not a comment, {- nor this -}\"\n-- a comment\n","expect":{"valid":true,"comments":[{"start":39,"end":51,"kind":"line","action":"remove"}]}},{"id":"profile-style-reads-the-profiles-own-marker","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"space_after_marker":true}},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- |Documentation written against its marker.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":45,"kind":"doc-line","action":"rewrite"}],"output_utf8":"-- | Documentation written against its marker.\nadd = 1\n"}},{"id":"wrap-joins-a-break-nobody-meant","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken\n/// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":84,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-breaks-after-every-sentence","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second on the same line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence.\n/// And a second on the same line.\nfn a() {}\n"}},{"id":"wrap-keeps-a-break-after-a-clause","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":49,"kind":"doc-line","action":"keep"},{"start":50,"end":85,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n"}},{"id":"wrap-unwrap-joins-without-breaking-sentences","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"unwrap"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was\n/// broken to fit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":78,"kind":"doc-line","action":"keep"},{"start":79,"end":97,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was broken to fit.\nfn a() {}\n"}},{"id":"wrap-leaves-a-fenced-code-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps\n/// here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":46,"kind":"doc-line","action":"keep"},{"start":47,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":68,"kind":"doc-line","action":"keep"},{"start":69,"end":83,"kind":"doc-line","action":"keep"},{"start":84,"end":109,"kind":"doc-line","action":"keep"},{"start":110,"end":117,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n"}},{"id":"wrap-leaves-a-section-heading","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":38,"kind":"doc-line","action":"keep"},{"start":39,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n"}},{"id":"wrap-leaves-a-link-reference-definition","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":70,"kind":"doc-line","action":"keep"},{"start":71,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n"}},{"id":"wrap-reaches-a-list-item-and-keeps-its-indentation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps\n/// onto the next line. And a second sentence.\n/// - another\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":105,"kind":"doc-line","action":"keep"},{"start":106,"end":119,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps onto the next line.\n/// And a second sentence.\n/// - another\nfn a() {}\n"}},{"id":"wrap-leaves-a-table","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":39,"kind":"doc-line","action":"keep"},{"start":40,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":67,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n"}},{"id":"wrap-does-not-break-inside-a-host-name","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details. Version 1.5 is fine.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":93,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details.\n/// Version 1.5 is fine.\nfn a() {}\n"}},{"id":"wrap-does-not-break-after-an-abbreviation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence. J. Smith neither.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence.\n/// J. Smith neither.\nfn a() {}\n"}},{"id":"wrap-breaks-a-cjk-sentence-without-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。これは二文目。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。\n/// これは二文目。\nfn a() {}\n"}},{"id":"wrap-joins-cjk-without-inserting-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで\n/// 折り返されている。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":89,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで折り返されている。\nfn a() {}\n"}},{"id":"wrap-reaches-a-line-comment-run-too","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken\n// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"line","action":"keep"},{"start":54,"end":80,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-leaves-a-run-whose-lines-open-differently","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n"}},{"id":"wrap-reaches-a-block-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":73,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line. */\nfn a() {}\n"}},{"id":"wrap-leaves-the-first-two-lines-alone","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"line","action":"keep"},{"start":27,"end":52,"kind":"line","action":"keep"}],"output_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n"}},{"id":"wrap-keeps-crlf-endings","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken\r\n/// to keep the line short.\r\nfn a() {}\r\n","expect":{"valid":true,"comments":[{"start":28,"end":58,"kind":"doc-line","action":"keep"},{"start":60,"end":87,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken to keep the line short.\r\nfn a() {}\r\n"}},{"id":"wrap-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n/// onto a second line.\nfn a() {}\n// a remark\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":78,"kind":"doc-line","action":"keep"},{"start":89,"end":100,"kind":"line","action":"remove"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps onto a second line.\nfn a() {}\n\nfn b() {}\n"}},{"id":"wrap-leaves-a-comment-beside-code","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":37,"end":61,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n"}},{"id":"wrap-reaches-the-first-line-where-no-preamble-is-read","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"//! Module documentation that was broken\n//! to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"doc-line","action":"keep"},{"start":41,"end":68,"kind":"doc-line","action":"keep"}],"output_utf8":"//! Module documentation that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-keeps-a-block-closer-on-its-own-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line.\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line.\n */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-that-fits-on-one-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":58,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n"}},{"id":"wrap-aligns-an-ocaml-block-under-its-text","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines\n are aligned under the text. And a second sentence. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":118,"kind":"block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines are aligned under the text.\n And a second sentence. *)\nlet a = 3\n"}},{"id":"wrap-reaches-an-ocaml-documentation-block","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps\n onto a second line. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":80,"kind":"doc-block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps onto a second line. *)\nlet a = 3\n"}},{"id":"wrap-keeps-a-blank-line-inside-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps\n * onto a line.\n *\n * A second paragraph. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps onto a line.\n *\n * A second paragraph. */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-whose-interior-is-a-code-example","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":100,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n"}},{"id":"wrap-leaves-an-example-indented-under-an-item","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps\n/// onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":50,"kind":"doc-line","action":"keep"},{"start":51,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":73,"kind":"doc-line","action":"keep"},{"start":74,"end":92,"kind":"doc-line","action":"keep"},{"start":93,"end":96,"kind":"doc-line","action":"keep"},{"start":97,"end":107,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n"}},{"id":"wrap-keeps-a-nested-list-nested","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps\n/// onto a line\n/// - inner item that wraps\n/// onto a line\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":71,"kind":"doc-line","action":"keep"},{"start":72,"end":101,"kind":"doc-line","action":"keep"},{"start":102,"end":121,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps onto a line\n/// - inner item that wraps onto a line\nfn a() {}\n"}},{"id":"wrap-splits-an-item-into-sentences-under-its-marker","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence. And a second.\n/// 2. Another.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence.\n/// And a second.\n/// 2. Another.\nfn a() {}\n"}},{"id":"wrap-splits-a-run-at-a-line-a-style-rule-cannot-reach","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps\n/// onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps\n/// onto a line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":52,"kind":"doc-line","action":"keep"},{"start":53,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":104,"kind":"directive","action":"keep"},{"start":105,"end":131,"kind":"doc-line","action":"keep"},{"start":132,"end":148,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps onto a line.\nfn a() {}\n"}},{"id":"wrap-joins-a-sentence-that-opens-with-an-intra-doc-link","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs\n/// to, because that run is longer than the limit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":90,"kind":"doc-line","action":"keep"},{"start":91,"end":141,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs to, because that run is longer than the limit.\nfn a() {}\n"}},{"id":"wrap-reaches-a-markdown-paragraph","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"A paragraph that wraps\nacross two lines. And a second sentence.\n","expect":{"valid":true,"comments":[],"output_utf8":"A paragraph that wraps across two lines.\nAnd a second sentence.\n"}},{"id":"wrap-leaves-a-markdown-fence","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n```\ncode that wraps\nshould not join.\n```\n","expect":{"valid":true,"comments":[],"output_utf8":"Prose that wraps across lines.\n\n```\ncode that wraps\nshould not join.\n```\n"}},{"id":"wrap-leaves-markdown-front-matter","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-heading-and-table","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-html-comment-to-the-comment-path","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n\n","expect":{"valid":true,"comments":[{"start":32,"end":80,"kind":"html-comment","action":"keep"}],"output_utf8":"Prose that wraps across lines.\n\n\n"}},{"id":"wrap-reaches-a-markdown-list-item","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- an item that wraps\n onto the next line. And a second sentence.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- an item that wraps onto the next line.\n And a second sentence.\n- another\n"}},{"id":"wrap-keeps-an-item-open-across-a-clause-break","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps\n onto two more lines.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps onto two more lines.\n- another\n"}},{"id":"wrap-writes-a-continued-item-under-its-marker","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n a second sentence. And a third.\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n a second sentence.\n And a third.\n"}},{"id":"wrap-keeps-the-indentation-the-source-wrote","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// A sentence that was broken\n /// to keep the line short.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"},{"start":48,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// A sentence that was broken to keep the line short.\n fn a() {}\n}\n"}},{"id":"wrap-indents-the-lines-a-split-opens","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// One sentence. Another one.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// One sentence.\n /// Another one.\n fn a() {}\n}\n"}},{"id":"wrap-refuses-a-run-whose-lines-sit-at-different-columns","language":"yaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n","expect":{"valid":true,"comments":[{"start":6,"end":19,"kind":"line","action":"keep"},{"start":24,"end":49,"kind":"line","action":"keep"},{"start":54,"end":75,"kind":"line","action":"keep"}],"output_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n"}},{"id":"declarative-profile-reaches-the-style-axis-too","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"wrap":"sentence"},"layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":"//","kind":"line"}],"block_comments":[],"strings":[],"protected_patterns":[]},"source_utf8":"call()\n// A remark. Another one.\ncall()\n","expect":{"valid":true,"comments":[{"start":7,"end":32,"kind":"line","action":"keep"}],"output_utf8":"call()\n// A remark.\n// Another one.\ncall()\n"}},{"id":"a-scan-records-the-run-it-rewrote","language":"rust","operation":"scan","options":{"policy":"none","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\n// A remark. Another one.\nfn also() {}\n","expect":{"valid":true,"comments":[{"start":13,"end":38,"kind":"line","action":"keep"}]}},{"id":"wrap-leaves-a-labelled-divider-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n","expect":{"valid":true,"comments":[{"start":4,"end":58,"kind":"line","action":"keep"},{"start":59,"end":117,"kind":"line","action":"keep"}],"output_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n"}},{"id":"wrap-leaves-a-mise-task-header-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":20,"end":96,"kind":"load-bearing","action":"keep"},{"start":97,"end":155,"kind":"load-bearing","action":"keep"},{"start":156,"end":157,"kind":"line","action":"keep"},{"start":158,"end":199,"kind":"line","action":"keep"}],"output_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n"}},{"id":"wrap-reads-a-label-as-a-marker-with-no-tag-list","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# NOTE: The policy this machine holds every commit to, as a setting\n# NOTE: rather than as a gate's own opinion. It merges under a project's.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":67,"kind":"line","action":"keep"},{"start":68,"end":141,"kind":"line","action":"keep"}],"output_utf8":"# NOTE: The policy this machine holds every commit to, as a setting rather than as a gate's own opinion.\n# NOTE: It merges under a project's.\nversion = 1\n"}},{"id":"wrap-does-not-read-an-ordinary-word-as-a-marker","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# The cat sat on the mat and then\n# the dog ran away. A second sentence.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":33,"kind":"line","action":"keep"},{"start":34,"end":72,"kind":"line","action":"keep"}],"output_utf8":"# The cat sat on the mat and then the dog ran away.\n# A second sentence.\nversion = 1\n"}},{"id":"allow-rules-do-not-reach-policy-none","language":"rust","operation":"scan","options":{"policy":"none","allow":{"tags":["NOTE"],"max_lines":1,"trailing":false}},"source_utf8":"// NOTE: one line.\npub fn a() {}\n\n// NOTE: goes on\n// NOTE: and on.\npub fn b() {}\n\npub fn c() {} // NOTE: beside code\n\n// plain\npub fn d() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"keep"},{"start":34,"end":50,"kind":"line","action":"keep"},{"start":51,"end":67,"kind":"line","action":"keep"},{"start":97,"end":117,"kind":"line","action":"keep"},{"start":119,"end":127,"kind":"line","action":"keep"}]}},{"id":"policy-none-restyles-what-it-refuses-to-remove","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","allow":{"max_lines":1,"trailing":false},"style":{"wrap":"sentence"}},"source_utf8":"// A first sentence wrapped to a\n// column. A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n","expect":{"valid":true,"comments":[{"start":0,"end":32,"kind":"line","action":"keep"},{"start":33,"end":62,"kind":"line","action":"keep"},{"start":92,"end":106,"kind":"line","action":"keep"}],"output_utf8":"// A first sentence wrapped to a column.\n// A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n"}}]} +{"version":1,"floors":{"cases":599,"expectations":599},"cases":[{"id":"rust-builtin-safe","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"r#\"// string\"# /* block */\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":15,"end":26,"kind":"block","action":"remove"},{"start":28,"end":35,"kind":"line","action":"remove"}],"output_utf8":"r#\"// string\"# \r\n\r\n"}},{"id":"rust-builtin-all","language":"rust","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"r#\"// string\"# /* block */\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":15,"end":26,"kind":"block","action":"remove"},{"start":28,"end":35,"kind":"line","action":"remove"}],"output_utf8":"r#\"// string\"# \r\n\r\n"}},{"id":"ocaml-builtin-safe","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\"(* string *)\" (* outer (* nested *) end *)\n","expect":{"valid":true,"comments":[{"start":15,"end":43,"kind":"block","action":"remove"}],"output_utf8":"\"(* string *)\" \n"}},{"id":"ocaml-builtin-all","language":"ocaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"\"(* string *)\" (* outer (* nested *) end *)\n","expect":{"valid":true,"comments":[{"start":15,"end":43,"kind":"block","action":"remove"}],"output_utf8":"\"(* string *)\" \n"}},{"id":"c-builtin-safe","language":"c","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"char *s = \"// string\"; /* block */\n// line\n","expect":{"valid":true,"comments":[{"start":23,"end":34,"kind":"block","action":"remove"},{"start":35,"end":42,"kind":"line","action":"remove"}],"output_utf8":"char *s = \"// string\"; \n\n"}},{"id":"c-builtin-all","language":"c","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"char *s = \"// string\"; /* block */\n// line\n","expect":{"valid":true,"comments":[{"start":23,"end":34,"kind":"block","action":"remove"},{"start":35,"end":42,"kind":"line","action":"remove"}],"output_utf8":"char *s = \"// string\"; \n\n"}},{"id":"cpp-builtin-safe","language":"cpp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"auto s = \"/* string */\"; // line\n","expect":{"valid":true,"comments":[{"start":25,"end":32,"kind":"line","action":"remove"}],"output_utf8":"auto s = \"/* string */\"; \n"}},{"id":"cpp-builtin-all","language":"cpp","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"auto s = \"/* string */\"; // line\n","expect":{"valid":true,"comments":[{"start":25,"end":32,"kind":"line","action":"remove"}],"output_utf8":"auto s = \"/* string */\"; \n"}},{"id":"go-builtin-safe","language":"go","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = `// raw`; /* block */\n","expect":{"valid":true,"comments":[{"start":18,"end":29,"kind":"block","action":"remove"}],"output_utf8":"var s = `// raw`; \n"}},{"id":"go-builtin-all","language":"go","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"var s = `// raw`; /* block */\n","expect":{"valid":true,"comments":[{"start":18,"end":29,"kind":"block","action":"remove"}],"output_utf8":"var s = `// raw`; \n"}},{"id":"java-builtin-safe","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"String s = \"// raw\"; // line\n","expect":{"valid":true,"comments":[{"start":21,"end":28,"kind":"line","action":"remove"}],"output_utf8":"String s = \"// raw\"; \n"}},{"id":"java-builtin-all","language":"java","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"String s = \"// raw\"; // line\n","expect":{"valid":true,"comments":[{"start":21,"end":28,"kind":"line","action":"remove"}],"output_utf8":"String s = \"// raw\"; \n"}},{"id":"javascript-builtin-safe","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const s = \"// raw\"; /* block */\n","expect":{"valid":true,"comments":[{"start":20,"end":31,"kind":"block","action":"remove"}],"output_utf8":"const s = \"// raw\"; \n"}},{"id":"javascript-builtin-all","language":"javascript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const s = \"// raw\"; /* block */\n","expect":{"valid":true,"comments":[{"start":20,"end":31,"kind":"block","action":"remove"}],"output_utf8":"const s = \"// raw\"; \n"}},{"id":"typescript-builtin-safe","language":"typescript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const s: string = \"// raw\"; // line\n","expect":{"valid":true,"comments":[{"start":28,"end":35,"kind":"line","action":"remove"}],"output_utf8":"const s: string = \"// raw\"; \n"}},{"id":"typescript-builtin-all","language":"typescript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const s: string = \"// raw\"; // line\n","expect":{"valid":true,"comments":[{"start":28,"end":35,"kind":"line","action":"remove"}],"output_utf8":"const s: string = \"// raw\"; \n"}},{"id":"python-builtin-safe","language":"python","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"s = \"# raw\" # line\n","expect":{"valid":true,"comments":[{"start":13,"end":19,"kind":"line","action":"remove"}],"output_utf8":"s = \"# raw\" \n"}},{"id":"python-builtin-all","language":"python","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"s = \"# raw\" # line\n","expect":{"valid":true,"comments":[{"start":13,"end":19,"kind":"line","action":"remove"}],"output_utf8":"s = \"# raw\" \n"}},{"id":"shell-builtin-safe","language":"shell","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"s='# raw' # line\n","expect":{"valid":true,"comments":[{"start":10,"end":16,"kind":"line","action":"remove"}],"output_utf8":"s='# raw' \n"}},{"id":"shell-builtin-all","language":"shell","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"s='# raw' # line\n","expect":{"valid":true,"comments":[{"start":10,"end":16,"kind":"line","action":"remove"}],"output_utf8":"s='# raw' \n"}},{"id":"html-builtin-safe","language":"html","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"html-comment","action":"keep"},{"start":32,"end":39,"kind":"line","action":"remove"}],"output_utf8":""}},{"id":"html-builtin-all","language":"html","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"html-comment","action":"remove"},{"start":32,"end":39,"kind":"line","action":"remove"}],"output_utf8":""}},{"id":"css-builtin-safe","language":"css","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"a{content:\"/* raw */\";/* block */}\n","expect":{"valid":true,"comments":[{"start":22,"end":33,"kind":"block","action":"remove"}],"output_utf8":"a{content:\"/* raw */\"; }\n"}},{"id":"css-builtin-all","language":"css","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"a{content:\"/* raw */\";/* block */}\n","expect":{"valid":true,"comments":[{"start":22,"end":33,"kind":"block","action":"remove"}],"output_utf8":"a{content:\"/* raw */\"; }\n"}},{"id":"jsonc-builtin-safe","language":"jsonc","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{\"x\":\"// raw\" // line\n}\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"}],"output_utf8":"{\"x\":\"// raw\" \n}\n"}},{"id":"jsonc-builtin-all","language":"jsonc","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"{\"x\":\"// raw\" // line\n}\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"}],"output_utf8":"{\"x\":\"// raw\" \n}\n"}},{"id":"sql-builtin-safe","language":"sql","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"select '-- raw'; -- line\n/* block */\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"line","action":"remove"},{"start":25,"end":36,"kind":"block","action":"remove"}],"output_utf8":"select '-- raw'; \n\n"}},{"id":"sql-builtin-all","language":"sql","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"select '-- raw'; -- line\n/* block */\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"line","action":"remove"},{"start":25,"end":36,"kind":"block","action":"remove"}],"output_utf8":"select '-- raw'; \n\n"}},{"id":"kotlin-builtin-safe","language":"kotlin","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val s = \"// raw\" // line\n/* outer /* nested */ end */","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"line","action":"remove"},{"start":25,"end":53,"kind":"block","action":"remove"}],"output_utf8":"val s = \"// raw\" \n"}},{"id":"kotlin-builtin-all","language":"kotlin","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"val s = \"// raw\" // line\n/* outer /* nested */ end */","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"line","action":"remove"},{"start":25,"end":53,"kind":"block","action":"remove"}],"output_utf8":"val s = \"// raw\" \n"}},{"id":"toml-builtin-safe","language":"toml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#:schema https://example.test/pyproject.json\nkey = \"# opaque\" # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":44,"kind":"directive","action":"keep"},{"start":62,"end":70,"kind":"line","action":"remove"}],"output_utf8":"#:schema https://example.test/pyproject.json\nkey = \"# opaque\" \n"}},{"id":"toml-builtin-all","language":"toml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"#:schema https://example.test/pyproject.json\nkey = \"# opaque\" # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":44,"kind":"directive","action":"remove"},{"start":62,"end":70,"kind":"line","action":"remove"}],"output_utf8":"\nkey = \"# opaque\" \n"}},{"id":"lua-builtin-safe","language":"lua","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"---@diagnostic disable-next-line: undefined-global\nprint([[-- opaque]]) -- remove\n","expect":{"valid":true,"comments":[{"start":0,"end":50,"kind":"directive","action":"keep"},{"start":72,"end":81,"kind":"line","action":"remove"}],"output_utf8":"---@diagnostic disable-next-line: undefined-global\nprint([[-- opaque]]) \n"}},{"id":"lua-builtin-all","language":"lua","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"---@diagnostic disable-next-line: undefined-global\nprint([[-- opaque]]) -- remove\n","expect":{"valid":true,"comments":[{"start":0,"end":50,"kind":"directive","action":"remove"},{"start":72,"end":81,"kind":"line","action":"remove"}],"output_utf8":"\nprint([[-- opaque]]) \n"}},{"id":"yaml-builtin-safe","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# yamllint disable-line rule:line-length\nkey: \"# opaque\" # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"directive","action":"keep"},{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"# yamllint disable-line rule:line-length\nkey: \"# opaque\" \n"}},{"id":"yaml-builtin-all","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"# yamllint disable-line rule:line-length\nkey: \"# opaque\" # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"directive","action":"remove"},{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"\nkey: \"# opaque\" \n"}},{"id":"php-builtin-safe","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\r\n# html
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":22,"kind":"directive","action":"keep"},{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"\r\n# html
\r\n"}},{"id":"php-builtin-all","language":"php","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"\r\n# html
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":22,"kind":"directive","action":"remove"},{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"\r\n# html
\r\n"}},{"id":"ruby-builtin-safe","language":"ruby","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env ruby\r\n# frozen_string_literal: true\r\nx = '# opaque' # remove\r\n=begin\r\ndoc\r\n=end\r\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":21,"end":50,"kind":"load-bearing","action":"keep"},{"start":67,"end":75,"kind":"line","action":"remove"},{"start":77,"end":94,"kind":"block","action":"remove"}],"output_utf8":"#!/usr/bin/env ruby\r\n# frozen_string_literal: true\r\nx = '# opaque' \r\n\r\n\r\n\r\n"}},{"id":"ruby-builtin-all","language":"ruby","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"#!/usr/bin/env ruby\r\n# frozen_string_literal: true\r\nx = '# opaque' # remove\r\n=begin\r\ndoc\r\n=end\r\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":21,"end":50,"kind":"load-bearing","action":"keep"},{"start":67,"end":75,"kind":"line","action":"remove"},{"start":77,"end":94,"kind":"block","action":"remove"}],"output_utf8":"#!/usr/bin/env ruby\r\n# frozen_string_literal: true\r\nx = '# opaque' \r\n\r\n\r\n\r\n"}},{"id":"zig-builtin-safe","language":"zig","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// zig fmt: off\r\nconst s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":15,"kind":"directive","action":"keep"},{"start":41,"end":48,"kind":"doc-line","action":"remove"},{"start":50,"end":57,"kind":"line","action":"remove"}],"output_utf8":"// zig fmt: off\r\nconst s = \"// string\";\r\n\r\n\r\n"}},{"id":"zig-builtin-all","language":"zig","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"// zig fmt: off\r\nconst s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":15,"kind":"directive","action":"remove"},{"start":41,"end":48,"kind":"doc-line","action":"remove"},{"start":50,"end":57,"kind":"line","action":"remove"}],"output_utf8":"\r\nconst s = \"// string\";\r\n\r\n\r\n"}},{"id":"r-builtin-safe","language":"r","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# styler: off\r\nx <- \"# string\"\r\n#' doc\r\n# line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":13,"kind":"directive","action":"keep"},{"start":32,"end":38,"kind":"doc-line","action":"remove"},{"start":40,"end":46,"kind":"line","action":"remove"}],"output_utf8":"# styler: off\r\nx <- \"# string\"\r\n\r\n\r\n"}},{"id":"r-builtin-all","language":"r","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"# styler: off\r\nx <- \"# string\"\r\n#' doc\r\n# line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":13,"kind":"directive","action":"remove"},{"start":32,"end":38,"kind":"doc-line","action":"remove"},{"start":40,"end":46,"kind":"line","action":"remove"}],"output_utf8":"\r\nx <- \"# string\"\r\n\r\n\r\n"}},{"id":"dart-builtin-safe","language":"dart","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// dart format off\r\nvar s = '// string';\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"directive","action":"keep"},{"start":42,"end":49,"kind":"doc-line","action":"remove"},{"start":51,"end":58,"kind":"line","action":"remove"}],"output_utf8":"// dart format off\r\nvar s = '// string';\r\n\r\n\r\n"}},{"id":"dart-builtin-all","language":"dart","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"// dart format off\r\nvar s = '// string';\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"directive","action":"remove"},{"start":42,"end":49,"kind":"doc-line","action":"remove"},{"start":51,"end":58,"kind":"line","action":"remove"}],"output_utf8":"\r\nvar s = '// string';\r\n\r\n\r\n"}},{"id":"swift-builtin-safe","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\r\nlet s = \"// string\"\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":49,"end":56,"kind":"doc-line","action":"remove"},{"start":58,"end":65,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\r\nlet s = \"// string\"\r\n\r\n\r\n"}},{"id":"swift-builtin-all","language":"swift","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\r\nlet s = \"// string\"\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":49,"end":56,"kind":"doc-line","action":"remove"},{"start":58,"end":65,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\r\nlet s = \"// string\"\r\n\r\n\r\n"}},{"id":"csharp-builtin-safe","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//{x /* c */}
\n\n","expect":{"valid":true,"comments":[{"start":19,"end":24,"kind":"line","action":"remove"},{"start":55,"end":62,"kind":"line","action":"remove"},{"start":78,"end":85,"kind":"block","action":"remove"},{"start":91,"end":104,"kind":"html-comment","action":"keep"}],"output_utf8":"\n\n{x }
\n\n"}},{"id":"markdown-builtin-safe","language":"markdown","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"text\n\nmore\n```rust\n// c\n```\n`// inline`\n","expect":{"valid":true,"comments":[{"start":5,"end":18,"kind":"html-comment","action":"keep"},{"start":32,"end":36,"kind":"line","action":"remove"}],"output_utf8":"text\n\nmore\n```rust\n\n```\n`// inline`\n"}},{"id":"perl-builtin-safe","language":"perl","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"=head1 NAME\n# not a comment\n=cut\nmy $x = 'a#b';\nif ($x =~ /a#b/) { print \"yes\\n\" }\nmy $y = $x / 2; # division\n","expect":{"valid":true,"comments":[{"start":99,"end":109,"kind":"line","action":"remove"}],"output_utf8":"=head1 NAME\n# not a comment\n=cut\nmy $x = 'a#b';\nif ($x =~ /a#b/) { print \"yes\\n\" }\nmy $y = $x / 2; \n"}},{"id":"rust-nested-raw","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"r#\"// opaque\"# /* outer /* inner */ end */\\n// rustfmt::skip\\n","expect":{"valid":true,"comments":[{"start":15,"end":42,"kind":"block","action":"remove"},{"start":44,"end":62,"kind":"directive","action":"keep"}],"output_utf8":"r#\"// opaque\"# \\n// rustfmt::skip\\n"}},{"id":"rust-raw-c-string","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"cr#\"inner \" // opaque\"#; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"cr#\"inner \" // opaque\"#; \n"}},{"id":"rust-multiline-string","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const A: &str = \"a\n// opaque\nb\"; // remove\n","expect":{"valid":true,"comments":[{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"const A: &str = \"a\n// opaque\nb\"; \n"}},{"id":"ocaml-nested-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{tag| (* opaque *) |tag} (* outer \"*)\" (* inner *) *)","expect":{"valid":true,"comments":[{"start":25,"end":53,"kind":"block","action":"remove"}],"output_utf8":"{tag| (* opaque *) |tag} "}},{"id":"ocaml-comment-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"(* outer {tag| *) opaque |tag} end *)","expect":{"valid":true,"comments":[{"start":0,"end":37,"kind":"block","action":"remove"}],"output_utf8":""}},{"id":"ocaml-long-quoted-id","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|(* opaque *)|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} (* remove *)","expect":{"valid":true,"comments":[{"start":177,"end":189,"kind":"block","action":"remove"}],"output_utf8":"{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|(* opaque *)|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} "}},{"id":"invalid-ocaml-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{tag| unterminated (* opaque *)","expect":{"valid":false,"comments":[],"output_utf8":"{tag| unterminated (* opaque *)"}},{"id":"c-line-splice","language":"c","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x; /\\\n/ comment\\\ncontinued\nint y;","expect":{"valid":true,"comments":[{"start":7,"end":30,"kind":"line","action":"remove"}],"output_utf8":"int x; \n\n\nint y;"}},{"id":"cpp-raw","language":"cpp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"R\"tag(/* opaque */ // opaque)tag\" // remove","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"R\"tag(/* opaque */ // opaque)tag\" "}},{"id":"go-directives","language":"go","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//go:build linux\n// +build linux\n//line generated.go:1\n// remove\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"load-bearing","action":"keep"},{"start":17,"end":32,"kind":"load-bearing","action":"keep"},{"start":33,"end":54,"kind":"directive","action":"keep"},{"start":55,"end":64,"kind":"line","action":"remove"}],"output_utf8":"//go:build linux\n// +build linux\n//line generated.go:1\n\n"}},{"id":"java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x; \\u002f\\u002f comment\\u000aint y;","expect":{"valid":true,"comments":[{"start":7,"end":27,"kind":"line","action":"remove"}],"output_utf8":"int x; \\u000aint y;"}},{"id":"java-unicode-surrogates","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"String s = \"\\uD83D\\uDE00 // opaque\"; // remove","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"String s = \"\\uD83D\\uDE00 // opaque\"; "}},{"id":"invalid-java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x = 1; \\u00G0 // known","expect":{"valid":false,"comments":[{"start":18,"end":26,"kind":"line","action":"remove"}],"output_utf8":"int x = 1; \\u00G0 // known"}},{"id":"forced-invalid-java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines","force_invalid":true},"source_utf8":"int x = 1; \\u00G0 // known","expect":{"valid":false,"comments":[{"start":18,"end":26,"kind":"line","action":"remove"}],"output_utf8":"int x = 1; \\u00G0 "}},{"id":"java-text-block-escape","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"String s = \"\"\"\n\\\"\"\" // opaque\nend\n\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"String s = \"\"\"\n\\\"\"\" // opaque\nend\n\"\"\"; \n"}},{"id":"java-inner-doc-marker","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// javadoc\n//! plain\n/** javadoc */\n/*! plain */\nclass A {}\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"remove"},{"start":12,"end":21,"kind":"line","action":"remove"},{"start":22,"end":36,"kind":"doc-block","action":"remove"},{"start":37,"end":49,"kind":"block","action":"remove"}],"output_utf8":"\n\n\n\nclass A {}\n"}},{"id":"javascript-goals","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env node\nconst r = /\\/\\/* opaque/;\nconst t = `literal // opaque ${1 /* remove */}`;\n// remove\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":79,"end":91,"kind":"block","action":"remove"},{"start":95,"end":104,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env node\nconst r = /\\/\\/* opaque/;\nconst t = `literal // opaque ${1 }`;\n\n"}},{"id":"javascript-control-regex","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"if (ready) /https?:\\/\\/example\\.test/.test(value); // remove","expect":{"valid":true,"comments":[{"start":51,"end":60,"kind":"line","action":"remove"}],"output_utf8":"if (ready) /https?:\\/\\/example\\.test/.test(value); "}},{"id":"javascript-brace-goals","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const ratio = {} / 2; // remove\nif (ready) {} /[/*]/.test(value); // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"},{"start":66,"end":75,"kind":"line","action":"remove"}],"output_utf8":"const ratio = {} / 2; \nif (ready) {} /[/*]/.test(value); \n"}},{"id":"javascript-html-like-comments","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const x = 1; remove\nconst text = '","expect":{"valid":true,"comments":[{"start":2,"end":20,"kind":"html-comment","action":"remove"},{"start":36,"end":41,"kind":"block","action":"remove"}],"output_utf8":"ab"}},{"id":"non-utf8-bytes","language":"c","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"/y8qIHJlbW92ZSAqL4ANCg==","expect":{"valid":true,"comments":[{"start":1,"end":13,"kind":"block","action":"remove"}],"output_base64":"/yCADQo="}},{"id":"compact-layout","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"left/* remove */right\n","expect":{"valid":true,"comments":[{"start":4,"end":16,"kind":"block","action":"remove"}],"output_utf8":"left right\n"}},{"id":"compact-whole-line-run","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"fn main() {}\n// one\n// two\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":13,"end":19,"kind":"line","action":"remove"},{"start":20,"end":26,"kind":"line","action":"remove"}],"output_utf8":"fn main() {}\nlet x = 1;\n"}},{"id":"compact-indented-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"fn main() {\n // note\n let x = 1;\n}\n","expect":{"valid":true,"comments":[{"start":16,"end":23,"kind":"line","action":"remove"}],"output_utf8":"fn main() {\n let x = 1;\n}\n"}},{"id":"compact-crlf-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1;\r\n// note\r\nlet y = 2;\r\n","expect":{"valid":true,"comments":[{"start":12,"end":19,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;\r\nlet y = 2;\r\n"}},{"id":"compact-trailing-whitespace","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1; \t // note\nlet y = 2;\t/* two */\t\nlet z = 3;\n","expect":{"valid":true,"comments":[{"start":13,"end":20,"kind":"line","action":"remove"},{"start":32,"end":41,"kind":"block","action":"remove"}],"output_utf8":"let x = 1;\nlet y = 2;\nlet z = 3;\n"}},{"id":"compact-no-final-newline","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1; // note","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;"}},{"id":"compact-last-line-only-comment","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1;\n// note","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;\n"}},{"id":"compact-block-shares-lines-with-code","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int a = 1; /* one\ntwo\nthree */ int b = 2;\n","expect":{"valid":true,"comments":[{"start":11,"end":30,"kind":"block","action":"remove"}],"output_utf8":"int a = 1;\n int b = 2;\n"}},{"id":"compact-block-alone-on-its-lines","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int a = 1;\n/* one\ntwo */\nint b = 2;\n","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"block","action":"remove"}],"output_utf8":"int a = 1;\nint b = 2;\n"}},{"id":"compact-block-at-end-without-newline","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int x = 1; /* one\ntwo */","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"block","action":"remove"}],"output_utf8":"int x = 1;\n"}},{"id":"compact-two-comments-on-one-line","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"a/* one */ /* two */\n","expect":{"valid":true,"comments":[{"start":1,"end":10,"kind":"block","action":"remove"},{"start":11,"end":20,"kind":"block","action":"remove"}],"output_utf8":"a\n"}},{"id":"compact-html-comment","language":"html","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"a
\n\nb
\n","expect":{"valid":true,"comments":[{"start":9,"end":22,"kind":"html-comment","action":"remove"},{"start":32,"end":48,"kind":"html-comment","action":"remove"}],"output_utf8":"a
\nb
\n"}},{"id":"compact-javascript-line-separator","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_base64":"bGV0IGEgPSAxO+KAqC8vIG5vdGXigKhsZXQgYiA9IDI7Cg==","expect":{"valid":true,"comments":[{"start":13,"end":20,"kind":"line","action":"remove"}],"output_base64":"bGV0IGEgPSAxO+KAqGxldCBiID0gMjsK"}},{"id":"compact-kept-comment-holds-its-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// rustfmt::skip\n// note\nfn main() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"directive","action":"keep"},{"start":17,"end":24,"kind":"line","action":"remove"}],"output_utf8":"// rustfmt::skip\nfn main() {}\n"}},{"id":"invalid-cpp-raw","language":"cpp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"R\"tag(unterminated /* opaque */","expect":{"valid":false,"comments":[],"output_utf8":"R\"tag(unterminated /* opaque */"}},{"id":"invalid-shell-quote","language":"shell","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"echo 'unterminated","expect":{"valid":false,"comments":[],"output_utf8":"echo 'unterminated"}},{"id":"invalid-shell-heredoc","language":"shell","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"cat <#not a comment
\n#not a comment\n\n","expect":{"valid":true,"comments":[{"start":10,"end":19,"kind":"line","action":"remove"}],"output_utf8":"= $name \n?>\n"}},{"id":"php-xml-decl-not-open-tag","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\nkept
\n","expect":{"valid":true,"comments":[{"start":6,"end":16,"kind":"line","action":"remove"}],"output_utf8":"kept
\n"}},{"id":"php-close-tag-swallows-newline","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n#!/usr/bin/env php\n\n#!/usr/bin/env php\n not html\"; $b = '?>'; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":" not html\"; $b = '?>'; \n"}},{"id":"php-shebang","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env php\n\r\nx
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":13,"kind":"line","action":"remove"},{"start":15,"end":32,"kind":"block","action":"remove"}],"output_utf8":"\r\nx
\r\n"}},{"id":"php-unterminated-heredoc","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"() {} // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":24,"kind":"line","action":"remove"}]}},{"id":"rust-unicode-loop-label","language":"rust","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"'ä: loop { break 'ä } // remove\n","expect":{"valid":true,"comments":[{"start":24,"end":33,"kind":"line","action":"remove"}]}},{"id":"ocaml-char-literal-across-newline","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = '\n' (* remove *)\nlet b = '\\\n' (* remove *)\n","expect":{"valid":true,"comments":[{"start":12,"end":24,"kind":"block","action":"remove"},{"start":38,"end":50,"kind":"block","action":"remove"}],"output_utf8":"let a = '\n' \nlet b = '\\\n' \n"}},{"id":"ruby-alias-percent-s","language":"ruby","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"alias%s(baz # x) %s(bar)\nputs 1 # remove\n","expect":{"valid":true,"comments":[{"start":32,"end":40,"kind":"line","action":"remove"}],"output_utf8":"alias%s(baz # x) %s(bar)\nputs 1 \n"}},{"id":"bom-shebang-dart","language":"dart","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAK"}},{"id":"swift-nested-block-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nlet a = 1 // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":35,"kind":"block","action":"remove"},{"start":46,"end":55,"kind":"line","action":"remove"}],"output_utf8":"\nlet a = 1 \n"}},{"id":"swift-doc-forms","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not swift\n/** doc */\n/*! bang */\n/**/\n/***/\n// line\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"doc-line","action":"remove"},{"start":18,"end":31,"kind":"line","action":"remove"},{"start":32,"end":42,"kind":"doc-block","action":"remove"},{"start":43,"end":54,"kind":"block","action":"remove"},{"start":55,"end":59,"kind":"block","action":"remove"},{"start":60,"end":65,"kind":"doc-block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\nlet a = 1\n"}},{"id":"swift-interpolation-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"v: \\( 1 /* c */ + 2 )\" // remove\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"block","action":"remove"},{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"let a = \"v: \\( 1 + 2 )\" \n"}},{"id":"swift-multiline-string","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\n// not\n\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = \"\"\"\n// not\n\"\"\"\n\n"}},{"id":"swift-raw-string-hashes","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = ##\"a \"# // not\"##\n// remove\n","expect":{"valid":true,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = ##\"a \"# // not\"##\n\n"}},{"id":"swift-raw-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":30,"end":39,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n\n"}},{"id":"swift-raw-interpolation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"v: \\#( 1 /* c */ ) and \\(1)\"# // remove\n","expect":{"valid":true,"comments":[{"start":19,"end":26,"kind":"block","action":"remove"},{"start":41,"end":50,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"v: \\#( 1 ) and \\(1)\"# \n"}},{"id":"swift-raw-quote-only","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"#\n\n"}},{"id":"swift-string-pound-boundary","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 \n"}},{"id":"swift-extended-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/https://x/# // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = #/https://x/# \n"}},{"id":"swift-extended-regex-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\n x y\n/#\n// remove\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\n x y\n/#\n\n"}},{"id":"swift-bare-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /a\\//;print(1) // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = /a\\//;print(1) \n"}},{"id":"swift-bare-regex-limitation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = / b\\//\nlet c = 1\n","expect":{"valid":true,"comments":[{"start":12,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = / b\\\nlet c = 1\n"}},{"id":"swift-division-not-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 1 / 2 // remove\nlet b = a/a/a // remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"},{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"let a = 1 / 2 \nlet b = a/a/a \n"}},{"id":"swift-regex-comment-wins","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /x//y/\nlet b = 1\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = /x\nlet b = 1\n"}},{"id":"swift-compiler-directive-not-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG\nlet a = 1 // remove\n#endif\n#warning(\"x // y\")\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG\nlet a = 1 \n#endif\n#warning(\"x // y\")\n"}},{"id":"swift-tools-version-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":27,"end":37,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\n\n"}},{"id":"swift-swiftlint-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swiftlint:disable force_cast\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"directive","action":"keep"},{"start":32,"end":42,"kind":"line","action":"remove"}],"output_utf8":"// swiftlint:disable force_cast\n\n"}},{"id":"swift-format-ignore-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-format-ignore-file\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":27,"kind":"directive","action":"keep"},{"start":28,"end":38,"kind":"line","action":"remove"}],"output_utf8":"// swift-format-ignore-file\n\n"}},{"id":"swift-mark-is-not-a-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// MARK: - Section\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"remove"},{"start":19,"end":29,"kind":"line","action":"remove"}],"output_utf8":"\n\n"}},{"id":"swift-unterminated-nested","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open /* inner */\nlet a = 1\n","expect":{"valid":false,"comments":[{"start":0,"end":30,"kind":"block","action":"remove"}],"output_utf8":"/* open /* inner */\nlet a = 1\n"}},{"id":"swift-unterminated-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\nopen\nlet b = 2\n","expect":{"valid":false,"comments":[],"output_utf8":"let a = \"\"\"\nopen\nlet b = 2\n"}},{"id":"swift-unterminated-extended-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\nopen\nlet b = 2 // remove\n","expect":{"valid":false,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\nopen\nlet b = 2 // remove\n"}},{"id":"swift-single-quoted-recovery","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 'x // not'\n// remove\n","expect":{"valid":true,"comments":[{"start":19,"end":28,"kind":"line","action":"remove"}],"output_utf8":"let a = 'x // not'\n\n"}},{"id":"swift-shebang","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env swift\n// remove\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"shebang","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env swift\n\nlet a = 1\n"}},{"id":"swift-crlf","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":62,"end":71,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n\r\n"}},{"id":"swift-columns","language":"swift","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":" \nlet x = 1 \n"}},{"id":"swift-compact","language":"swift","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":"let x = 1\n"}},{"id":"bom-shebang-javascript","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IC8vIHJlbW92ZQo=","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IAo="}},{"id":"csharp-doc-forms","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not csharp\n/** doc */\n/*! bang */\n/**/\n/***/\n/*** three */\n// line\nclass C { }\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"line","action":"remove"},{"start":18,"end":32,"kind":"line","action":"remove"},{"start":33,"end":43,"kind":"doc-block","action":"remove"},{"start":44,"end":55,"kind":"block","action":"remove"},{"start":56,"end":60,"kind":"block","action":"remove"},{"start":61,"end":66,"kind":"block","action":"remove"},{"start":67,"end":80,"kind":"block","action":"remove"},{"start":81,"end":88,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\n\nclass C { }\n"}},{"id":"csharp-non-nested-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"remove"},{"start":47,"end":56,"kind":"line","action":"remove"}],"output_utf8":" still outer */\nvar a = 1; \n"}},{"id":"csharp-verbatim-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"quote \"\" inside // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"quote \"\" inside // no\"; \n"}},{"id":"csharp-verbatim-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"first // no\nsecond */ no\"; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"first // no\nsecond */ no\"; \n"}},{"id":"csharp-verbatim-identifier","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var @class = 1; // remove\n","expect":{"valid":true,"comments":[{"start":16,"end":25,"kind":"line","action":"remove"}],"output_utf8":"var @class = 1; \n"}},{"id":"csharp-interpolated-braces-escape","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{{literal}} // no {x} tail\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{{literal}} // no {x} tail\"; \n"}},{"id":"csharp-interpolated-hole-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x /* hole */} // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":25,"kind":"block","action":"remove"},{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x } // no\"; \n"}},{"id":"csharp-interpolated-hole-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x // hole\n}\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":22,"kind":"line","action":"remove"},{"start":27,"end":36,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x \n}\"; \n"}},{"id":"csharp-interpolated-format-clause","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{x:D4 // no}\"; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{x:D4 // no}\"; \n"}},{"id":"csharp-verbatim-interpolated","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; // remove\n","expect":{"valid":true,"comments":[{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; \n"}},{"id":"csharp-raw-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; \n"}},{"id":"csharp-raw-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\n body // no\n \"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\n body // no\n \"\"\"; \n"}},{"id":"csharp-raw-interpolated-dollar","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $$\"\"\"{not a hole} {{x /* hole */}} // no\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":30,"end":40,"kind":"block","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"var s = $$\"\"\"{not a hole} {{x }} // no\"\"\"; \n"}},{"id":"csharp-utf8-literal","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"bytes // no\"u8; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = \"bytes // no\"u8; \n"}},{"id":"csharp-string-escape-carries-a-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"a\\\nb // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var s = \"a\\\nb // no\"; \n"}},{"id":"csharp-character-literals","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"char a = '/'; char b = '\\''; char c = '\"'; // remove\n","expect":{"valid":true,"comments":[{"start":43,"end":52,"kind":"line","action":"remove"}],"output_utf8":"char a = '/'; char b = '\\''; char c = '\"'; \n"}},{"id":"csharp-preprocessor-if-with-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG // kept\nvar a = 1; // remove\n#endif // tail\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"},{"start":46,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG \nvar a = 1; \n#endif \n"}},{"id":"csharp-region-text-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#region Name // not a comment\n#endregion // a comment\n","expect":{"valid":true,"comments":[{"start":41,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#region Name // not a comment\n#endregion \n"}},{"id":"csharp-pragma-text","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#pragma warning disable 1591 // a comment\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":29,"end":41,"kind":"line","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"#pragma warning disable 1591 \nvar a = 1; \n"}},{"id":"csharp-line-directive-string","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#line 1 \"a//b.cs\" // tail\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"},{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"#line 1 \"a//b.cs\" \nvar a = 1; \n"}},{"id":"csharp-error-message-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#error boom // no\n","expect":{"valid":true,"comments":[],"output_utf8":"#error boom // no\n"}},{"id":"csharp-directive-block-comment-is-not-one","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; \n"}},{"id":"csharp-hash-after-code-is-not-a-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var a = 1; #if X // no\n#endif\n","expect":{"valid":true,"comments":[],"output_utf8":"var a = 1; #if X // no\n#endif\n"}},{"id":"csharp-unicode-line-terminator","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"dmFyIGEgPSAxOyAvLyBj4oCodmFyIGIgPSAyOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"}],"output_base64":"dmFyIGEgPSAxOyDigKh2YXIgYiA9IDI7IAo="}},{"id":"csharp-auto-generated-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//{x // c\n}
\n\n","expect":{"valid":true,"comments":[{"start":6,"end":10,"kind":"line","action":"remove"},{"start":17,"end":30,"kind":"html-comment","action":"keep"}],"output_utf8":"{x \n}
\n\n"}},{"id":"markdown-fences-and-inline-code","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"```nope\n// not a comment\n```\n`// not either`\n /* nor this */\n","expect":{"valid":true,"comments":[]}},{"id":"perl-ambiguous-slash-after-paren","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"sub f { 1 }\nf() /a#b/;\nmy $x = (2) / 2; # division\n","expect":{"valid":false,"comments":[]}},{"id":"perl-compound-opaque-sections","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"my @items = (1);\nprint $#items, $^X; # variables\nmy $q = \"escaped \\\" # opaque\"; # quote\n$x =~ s/foo#one/bar#two/g; # substitution\nprint << \"ONE\", <<~'TWO';\n# first body\nONE\n # second body\n TWO\n=pod\n# pod body\n=cutlery\n# still pod\n=cut\nformat STDOUT =\n@<<<<<<<<\n# picture body\n.\n# after format\n__DATA__\n# data body\n","expect":{"valid":true,"comments":[{"start":37,"end":48,"kind":"line","action":"remove"},{"start":80,"end":87,"kind":"line","action":"remove"},{"start":115,"end":129,"kind":"line","action":"remove"},{"start":281,"end":295,"kind":"line","action":"remove"}]}},{"id":"scss-interpolation-in-string-and-url","language":"css","dialect":"scss","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a { x: \"#{1 /* string */}\"; y: url( \"#{2 /* url */}\" ); z: url(foo\\)bar//opaque); // outer\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":25,"kind":"block","action":"remove"},{"start":42,"end":51,"kind":"block","action":"remove"},{"start":83,"end":91,"kind":"line","action":"remove"}]}},{"id":"sass-silent-comment-indented-body","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a\n // parent\n color: red\n width: 1px\n color: blue\n// root\n nested: yes\n.b\n color: green\n","expect":{"valid":true,"comments":[{"start":5,"end":46,"kind":"line","action":"remove"},{"start":61,"end":82,"kind":"line","action":"remove"}]}},{"id":"vue-exact-attributes-directives-and-nested-v-pre","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"x
\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\nx
\n"}},{"id":"profile-longest-token-wins-over-declaration-order","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"//// module\n/// item\n// remark\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"keep"},{"start":12,"end":20,"kind":"doc-line","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}]}},{"id":"profile-prefix-delimiters-are-not-ambiguous","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"///doc\n//remark\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"keep"},{"start":7,"end":15,"kind":"line","action":"remove"}]}},{"id":"profile-a-string-still-hides-a-comment-token","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"pub const s = \"// not a comment\"\n// a comment\n","expect":{"valid":true,"comments":[{"start":33,"end":45,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-dashes-open-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- a remark\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-an-operator-is-not-a-comment","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a --> b\nc <-- d\n","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"}],"output_utf8":"a --> b\nc <\n"}},{"id":"profile-haskell-a-longer-run-of-dashes-is-still-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"---x is a comment\ny = 2\n","expect":{"valid":true,"comments":[{"start":0,"end":17,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-longer-run-before-a-symbol-is-an-operator","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a ----> b\n","expect":{"valid":true,"comments":[],"output_utf8":"a ----> b\n"}},{"id":"profile-haskell-haddock-continues-with-the-plain-opener","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | The first line is marked.\n-- The rest is not.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"doc-line","action":"keep"},{"start":31,"end":52,"kind":"doc-line","action":"keep"}]}},{"id":"profile-haskell-a-blank-line-ends-the-continuation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\n\n-- an unrelated remark\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":21,"end":43,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-remark-below-code-is-not-documentation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\nadd = 1\n-- an unrelated remark\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":28,"end":50,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-nesting-counts-the-pairing","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n","expect":{"valid":true,"comments":[{"start":0,"end":58,"kind":"doc-block","action":"keep"}],"output_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n"}},{"id":"profile-haskell-a-string-hides-both-comment-forms","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"s = \"-- not a comment, {- nor this -}\"\n-- a comment\n","expect":{"valid":true,"comments":[{"start":39,"end":51,"kind":"line","action":"remove"}]}},{"id":"profile-style-reads-the-profiles-own-marker","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"space_after_marker":true}},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- |Documentation written against its marker.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":45,"kind":"doc-line","action":"rewrite"}],"output_utf8":"-- | Documentation written against its marker.\nadd = 1\n"}},{"id":"wrap-joins-a-break-nobody-meant","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken\n/// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":84,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-breaks-after-every-sentence","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second on the same line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence.\n/// And a second on the same line.\nfn a() {}\n"}},{"id":"wrap-keeps-a-break-after-a-clause","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":49,"kind":"doc-line","action":"keep"},{"start":50,"end":85,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n"}},{"id":"wrap-unwrap-joins-without-breaking-sentences","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"unwrap"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was\n/// broken to fit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":78,"kind":"doc-line","action":"keep"},{"start":79,"end":97,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was broken to fit.\nfn a() {}\n"}},{"id":"wrap-leaves-a-fenced-code-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps\n/// here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":46,"kind":"doc-line","action":"keep"},{"start":47,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":68,"kind":"doc-line","action":"keep"},{"start":69,"end":83,"kind":"doc-line","action":"keep"},{"start":84,"end":109,"kind":"doc-line","action":"keep"},{"start":110,"end":117,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n"}},{"id":"wrap-leaves-a-section-heading","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":38,"kind":"doc-line","action":"keep"},{"start":39,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n"}},{"id":"wrap-leaves-a-link-reference-definition","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":70,"kind":"doc-line","action":"keep"},{"start":71,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n"}},{"id":"wrap-reaches-a-list-item-and-keeps-its-indentation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps\n/// onto the next line. And a second sentence.\n/// - another\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":105,"kind":"doc-line","action":"keep"},{"start":106,"end":119,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps onto the next line.\n/// And a second sentence.\n/// - another\nfn a() {}\n"}},{"id":"wrap-leaves-a-table","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":39,"kind":"doc-line","action":"keep"},{"start":40,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":67,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n"}},{"id":"wrap-does-not-break-inside-a-host-name","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details. Version 1.5 is fine.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":93,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details.\n/// Version 1.5 is fine.\nfn a() {}\n"}},{"id":"wrap-does-not-break-after-an-abbreviation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence. J. Smith neither.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence.\n/// J. Smith neither.\nfn a() {}\n"}},{"id":"wrap-breaks-a-cjk-sentence-without-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。これは二文目。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。\n/// これは二文目。\nfn a() {}\n"}},{"id":"wrap-joins-cjk-without-inserting-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで\n/// 折り返されている。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":89,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで折り返されている。\nfn a() {}\n"}},{"id":"wrap-reaches-a-line-comment-run-too","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken\n// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"line","action":"keep"},{"start":54,"end":80,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-leaves-a-run-whose-lines-open-differently","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n"}},{"id":"wrap-reaches-a-block-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":73,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line. */\nfn a() {}\n"}},{"id":"wrap-leaves-the-first-two-lines-alone","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"line","action":"keep"},{"start":27,"end":52,"kind":"line","action":"keep"}],"output_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n"}},{"id":"wrap-keeps-crlf-endings","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken\r\n/// to keep the line short.\r\nfn a() {}\r\n","expect":{"valid":true,"comments":[{"start":28,"end":58,"kind":"doc-line","action":"keep"},{"start":60,"end":87,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken to keep the line short.\r\nfn a() {}\r\n"}},{"id":"wrap-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n/// onto a second line.\nfn a() {}\n// a remark\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":78,"kind":"doc-line","action":"keep"},{"start":89,"end":100,"kind":"line","action":"remove"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps onto a second line.\nfn a() {}\n\nfn b() {}\n"}},{"id":"wrap-leaves-a-comment-beside-code","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":37,"end":61,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n"}},{"id":"wrap-reaches-the-first-line-where-no-preamble-is-read","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"//! Module documentation that was broken\n//! to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"doc-line","action":"keep"},{"start":41,"end":68,"kind":"doc-line","action":"keep"}],"output_utf8":"//! Module documentation that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-keeps-a-block-closer-on-its-own-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line.\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line.\n */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-that-fits-on-one-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":58,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n"}},{"id":"wrap-aligns-an-ocaml-block-under-its-text","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines\n are aligned under the text. And a second sentence. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":118,"kind":"block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines are aligned under the text.\n And a second sentence. *)\nlet a = 3\n"}},{"id":"wrap-reaches-an-ocaml-documentation-block","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps\n onto a second line. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":80,"kind":"doc-block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps onto a second line. *)\nlet a = 3\n"}},{"id":"wrap-keeps-a-blank-line-inside-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps\n * onto a line.\n *\n * A second paragraph. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps onto a line.\n *\n * A second paragraph. */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-whose-interior-is-a-code-example","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":100,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n"}},{"id":"wrap-leaves-an-example-indented-under-an-item","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps\n/// onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":50,"kind":"doc-line","action":"keep"},{"start":51,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":73,"kind":"doc-line","action":"keep"},{"start":74,"end":92,"kind":"doc-line","action":"keep"},{"start":93,"end":96,"kind":"doc-line","action":"keep"},{"start":97,"end":107,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n"}},{"id":"wrap-keeps-a-nested-list-nested","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps\n/// onto a line\n/// - inner item that wraps\n/// onto a line\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":71,"kind":"doc-line","action":"keep"},{"start":72,"end":101,"kind":"doc-line","action":"keep"},{"start":102,"end":121,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps onto a line\n/// - inner item that wraps onto a line\nfn a() {}\n"}},{"id":"wrap-splits-an-item-into-sentences-under-its-marker","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence. And a second.\n/// 2. Another.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence.\n/// And a second.\n/// 2. Another.\nfn a() {}\n"}},{"id":"wrap-splits-a-run-at-a-line-a-style-rule-cannot-reach","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps\n/// onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps\n/// onto a line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":52,"kind":"doc-line","action":"keep"},{"start":53,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":104,"kind":"directive","action":"keep"},{"start":105,"end":131,"kind":"doc-line","action":"keep"},{"start":132,"end":148,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps onto a line.\nfn a() {}\n"}},{"id":"wrap-joins-a-sentence-that-opens-with-an-intra-doc-link","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs\n/// to, because that run is longer than the limit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":90,"kind":"doc-line","action":"keep"},{"start":91,"end":141,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs to, because that run is longer than the limit.\nfn a() {}\n"}},{"id":"wrap-reaches-a-markdown-paragraph","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"A paragraph that wraps\nacross two lines. And a second sentence.\n","expect":{"valid":true,"comments":[],"output_utf8":"A paragraph that wraps across two lines.\nAnd a second sentence.\n"}},{"id":"wrap-leaves-a-markdown-fence","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n```\ncode that wraps\nshould not join.\n```\n","expect":{"valid":true,"comments":[],"output_utf8":"Prose that wraps across lines.\n\n```\ncode that wraps\nshould not join.\n```\n"}},{"id":"wrap-leaves-markdown-front-matter","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-heading-and-table","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-html-comment-to-the-comment-path","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n\n","expect":{"valid":true,"comments":[{"start":32,"end":80,"kind":"html-comment","action":"keep"}],"output_utf8":"Prose that wraps across lines.\n\n\n"}},{"id":"wrap-reaches-a-markdown-list-item","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- an item that wraps\n onto the next line. And a second sentence.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- an item that wraps onto the next line.\n And a second sentence.\n- another\n"}},{"id":"wrap-keeps-an-item-open-across-a-clause-break","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps\n onto two more lines.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps onto two more lines.\n- another\n"}},{"id":"wrap-writes-a-continued-item-under-its-marker","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n a second sentence. And a third.\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n a second sentence.\n And a third.\n"}},{"id":"wrap-keeps-the-indentation-the-source-wrote","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// A sentence that was broken\n /// to keep the line short.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"},{"start":48,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// A sentence that was broken to keep the line short.\n fn a() {}\n}\n"}},{"id":"wrap-indents-the-lines-a-split-opens","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// One sentence. Another one.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// One sentence.\n /// Another one.\n fn a() {}\n}\n"}},{"id":"wrap-refuses-a-run-whose-lines-sit-at-different-columns","language":"yaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n","expect":{"valid":true,"comments":[{"start":6,"end":19,"kind":"line","action":"keep"},{"start":24,"end":49,"kind":"line","action":"keep"},{"start":54,"end":75,"kind":"line","action":"keep"}],"output_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n"}},{"id":"declarative-profile-reaches-the-style-axis-too","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"wrap":"sentence"},"layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":"//","kind":"line"}],"block_comments":[],"strings":[],"protected_patterns":[]},"source_utf8":"call()\n// A remark. Another one.\ncall()\n","expect":{"valid":true,"comments":[{"start":7,"end":32,"kind":"line","action":"keep"}],"output_utf8":"call()\n// A remark.\n// Another one.\ncall()\n"}},{"id":"a-scan-records-the-run-it-rewrote","language":"rust","operation":"scan","options":{"policy":"none","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\n// A remark. Another one.\nfn also() {}\n","expect":{"valid":true,"comments":[{"start":13,"end":38,"kind":"line","action":"keep"}]}},{"id":"wrap-leaves-a-labelled-divider-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n","expect":{"valid":true,"comments":[{"start":4,"end":58,"kind":"line","action":"keep"},{"start":59,"end":117,"kind":"line","action":"keep"}],"output_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n"}},{"id":"wrap-leaves-a-mise-task-header-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":20,"end":96,"kind":"load-bearing","action":"keep"},{"start":97,"end":155,"kind":"load-bearing","action":"keep"},{"start":156,"end":157,"kind":"line","action":"keep"},{"start":158,"end":199,"kind":"line","action":"keep"}],"output_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n"}},{"id":"wrap-reads-a-label-as-a-marker-with-no-tag-list","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# NOTE: The policy this machine holds every commit to, as a setting\n# NOTE: rather than as a gate's own opinion. It merges under a project's.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":67,"kind":"line","action":"keep"},{"start":68,"end":141,"kind":"line","action":"keep"}],"output_utf8":"# NOTE: The policy this machine holds every commit to, as a setting rather than as a gate's own opinion.\n# NOTE: It merges under a project's.\nversion = 1\n"}},{"id":"wrap-does-not-read-an-ordinary-word-as-a-marker","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# The cat sat on the mat and then\n# the dog ran away. A second sentence.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":33,"kind":"line","action":"keep"},{"start":34,"end":72,"kind":"line","action":"keep"}],"output_utf8":"# The cat sat on the mat and then the dog ran away.\n# A second sentence.\nversion = 1\n"}},{"id":"allow-rules-do-not-reach-policy-none","language":"rust","operation":"scan","options":{"policy":"none","allow":{"tags":["NOTE"],"max_lines":1,"trailing":false}},"source_utf8":"// NOTE: one line.\npub fn a() {}\n\n// NOTE: goes on\n// NOTE: and on.\npub fn b() {}\n\npub fn c() {} // NOTE: beside code\n\n// plain\npub fn d() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"keep"},{"start":34,"end":50,"kind":"line","action":"keep"},{"start":51,"end":67,"kind":"line","action":"keep"},{"start":97,"end":117,"kind":"line","action":"keep"},{"start":119,"end":127,"kind":"line","action":"keep"}]}},{"id":"policy-none-restyles-what-it-refuses-to-remove","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","allow":{"max_lines":1,"trailing":false},"style":{"wrap":"sentence"}},"source_utf8":"// A first sentence wrapped to a\n// column. A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n","expect":{"valid":true,"comments":[{"start":0,"end":32,"kind":"line","action":"keep"},{"start":33,"end":62,"kind":"line","action":"keep"},{"start":92,"end":106,"kind":"line","action":"keep"}],"output_utf8":"// A first sentence wrapped to a column.\n// A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n"}}]} diff --git a/rust/ocomment/tests/cli.rs b/rust/ocomment/tests/cli.rs index ed19845..dd0b8e8 100644 --- a/rust/ocomment/tests/cli.rs +++ b/rust/ocomment/tests/cli.rs @@ -831,6 +831,30 @@ fn a_gemfile_is_scanned_as_ruby_by_its_name_alone() { ); } +/// A fence under a list item is read without the item's indentation, as CommonMark reads it, so the heredoc in it ends at its `EOF`, the file is valid, and `fix` removes the comment after the heredoc where it stands on the page. +#[test] +fn a_heredoc_in_a_fence_under_a_list_item_is_fixed_in_place() { + let directory = tempfile::tempdir().unwrap(); + let path = directory.path().join("steps.md"); + fs::write( + &path, + b"1. Step:\n\n ```sh\n cat <<'EOF'\n # heredoc text\n EOF\n echo done # remove\n ```\n", + ) + .unwrap(); + + let fixed = run(directory.path(), &["fix", "steps.md"]); + assert_eq!( + fixed.status.code(), + Some(0), + "{}", + String::from_utf8_lossy(&fixed.stderr) + ); + assert_eq!( + fs::read(&path).unwrap(), + b"1. Step:\n\n ```sh\n cat <<'EOF'\n # heredoc text\n EOF\n echo done \n ```\n" + ); +} + #[test] fn invalid_input_returns_two_and_fix_is_non_destructive() { let directory = tempfile::tempdir().unwrap(); diff --git a/spec/fixtures/v1/floor.txt b/spec/fixtures/v1/floor.txt index 109575c..1b0ebce 100644 --- a/spec/fixtures/v1/floor.txt +++ b/spec/fixtures/v1/floor.txt @@ -16,5 +16,5 @@ # Blank lines and `#` lines are ignored; every other line is a name and a # decimal count separated by white space. -cases 596 -expectations 596 +cases 599 +expectations 599 diff --git a/spec/fixtures/v1/hazards.json b/spec/fixtures/v1/hazards.json index 19ce8a8..6338307 100644 --- a/spec/fixtures/v1/hazards.json +++ b/spec/fixtures/v1/hazards.json @@ -11820,6 +11820,78 @@ "diagnostics": [] } }, + { + "id": "markdown-indented-fence-takes-its-indentation-off-each-line", + "language": "markdown", + "operation": "transform", + "options": { + "policy": "standard", + "layout": "lines" + }, + "source_utf8": " ```sh\n cat <<'EOF'\n EOF\n EOF\n # comment\n ```\n", + "note": "CommonMark 0.31.2, 4.5: a fence indented N spaces takes up to N spaces of indentation off each line of its content, so under a two-space opener ` EOF` keeps one space and is heredoc text, ` EOF` loses the one it has and ends the heredoc, and `# comment` after it is a shell comment. Ground truth, `commonmark` 0.31.2 and `markdown-it` 15.0.2: the block's content is `cat <<'EOF'\\n EOF\\nEOF\\n# comment\\n`, and bash run over it prints ` EOF`.", + "expect": { + "valid": true, + "comments": [ + { + "start": 36, + "end": 45, + "kind": "line", + "action": "remove" + } + ], + "diagnostics": [], + "output_utf8": " ```sh\n cat <<'EOF'\n EOF\n EOF\n \n ```\n" + } + }, + { + "id": "markdown-fence-under-a-list-item-loses-the-item-indentation", + "language": "markdown", + "operation": "transform", + "options": { + "policy": "standard", + "layout": "lines" + }, + "source_utf8": "# T\n\n1. Step:\n\n ```sh\n cat <<'EOF'\n # heredoc text\n EOF\n echo done # remove\n ```\n", + "note": "CommonMark 0.31.2, 5.2 and 4.5: the three columns in front of a fence under `1. ` belong to the list item, which takes them off every line of the block; read as the fence's own indentation they come off the same way. So the `EOF` ends the heredoc, `# heredoc text` is heredoc text, and only `# remove` is a comment. Ground truth, `commonmark` 0.31.2 and `markdown-it` 15.0.2: the block's content is `cat <<'EOF'\\n# heredoc text\\nEOF\\necho done # remove\\n`, and bash run over it prints `# heredoc text` and `done`.", + "expect": { + "valid": true, + "comments": [ + { + "start": 77, + "end": 85, + "kind": "line", + "action": "remove" + } + ], + "diagnostics": [], + "output_utf8": "# T\n\n1. Step:\n\n ```sh\n cat <<'EOF'\n # heredoc text\n EOF\n echo done \n ```\n" + } + }, + { + "id": "markdown-indented-fence-counts-a-tab-to-its-stop", + "language": "markdown", + "operation": "transform", + "options": { + "policy": "standard", + "layout": "lines" + }, + "source_utf8": " ```sh\n cat <<-EOF\n\tEOF\n # still heredoc text\n EOF\n echo done # remove\n ```\n", + "note": "CommonMark 0.31.2, 2.2 and 4.5: a tab in the indentation reaches the next multiple of four columns, so a three-space opener takes three of a leading tab's four columns and leaves one as a space. `\\tEOF` becomes ` EOF`, which `<<-` does not strip and so does not end the heredoc: `# still heredoc text` is heredoc text, the `EOF` under it ends the heredoc, and only `# remove` is a comment. Ground truth, `commonmark` 0.31.2 and `markdown-it` 15.0.2: the block's content is `cat <<-EOF\\n EOF\\n# still heredoc text\\nEOF\\necho done # remove\\n`, and bash run over it prints ` EOF` and `# still heredoc text`.", + "expect": { + "valid": true, + "comments": [ + { + "start": 72, + "end": 80, + "kind": "line", + "action": "remove" + } + ], + "diagnostics": [], + "output_utf8": " ```sh\n cat <<-EOF\n\tEOF\n # still heredoc text\n EOF\n echo done \n ```\n" + } + }, { "id": "sass-nested-interpolation-single-diagnostic", "language": "css",