From e6f55edc31d2bfc57ee0e9d81adb031820ea4c2f Mon Sep 17 00:00:00 2001 From: Yasunobu <42543015+P4suta@users.noreply.github.com> Date: Thu, 24 Sep 2026 12:19:34 +0900 Subject: [PATCH 1/2] fix: keep a mise file task's header as a load-bearing directive mise and its usage library read a file task's configuration from comments at the head of the script: `#` or `//`, optional whitespace, then `MISE` or `USAGE`, bare or in square brackets, matched case-sensitively on the raw line. These 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. Both implementations now recognise the header in every language, from the raw bytes, and file it in the load-bearing tier: `#MISE depends=` and `dir=` decide what runs and `#USAGE flag` declares an argument, so removing one changes the task rather than a report about it. As a directive it also ends a paragraph, so the reflow no longer joins it or writes a space after its `#`. `# mise installs the runtime`, `# Usage: audit` and `#MISEish` stay prose. The spec lists both names under `load_bearing` and names them in no `[load_bearing_by_language]` entry, for the reason the cross-language tool markers are absent from `[protected_by_language]`. Three fixtures pin the removal protection in shell and JavaScript and the header a dotfiles repository wrote surviving a sentence wrap byte for byte. --- CHANGELOG.md | 5 + docs/why-kept.md | 2 + ocaml/lib/ocomment_ref.ml | 25 ++++ rust/ocomment-core/src/scanner.rs | 36 +++++ rust/ocomment-core/tests/languages.rs | 69 +++++++++ rust/ocomment/assets/directives.toml | 6 +- rust/ocomment/assets/selftest-corpus.json | 2 +- spec/directives.toml | 6 +- spec/fixtures/v1/floor.txt | 4 +- spec/fixtures/v1/hazards.json | 171 ++++++++++++++++++++++ tools/check_directives.py | 18 +++ tools/fuzz_differential.py | 1 + tools/gen_docs.py | 2 + 13 files changed, 342 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dd644b..9cd791b 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 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. + They are now kept by every policy, including `--policy all` without `--force-protected`, and end a paragraph as `# shellcheck` does, while `# mise installs the runtime` and `# Usage: audit` stay prose. + - The test suite runs on the systems this repository publishes a binary for. `cargo test` ran on Linux alone while `release.yml` shipped `x86_64-pc-windows-msvc`; what Windows CI measured was that the crate builds diff --git a/docs/why-kept.md b/docs/why-kept.md index 47cace1..a8db7bf 100644 --- a/docs/why-kept.md +++ b/docs/why-kept.md @@ -133,6 +133,8 @@ is the only way to give one up. | `#__PURE__` | `javascript` | `/*#__PURE__*/` | `load-bearing` | required by the language or its build | | `@__PURE__` | `javascript` | `/*@__PURE__*/` | `load-bearing` | required by the language or its build | | `#__NO_SIDE_EFFECTS__` | `javascript` | `/*#__NO_SIDE_EFFECTS__*/` | `load-bearing` | required by the language or its build | +| `MISE` | `shell` | `#MISE description="Audit the signing posture"` | `load-bearing` | required by the language or its build | +| `USAGE` | `shell` | `#USAGE flag "--fix" help="Repair what the audit finds"` | `load-bearing` | required by the language or its build | | `shebang` | `shell` | `#!/bin/sh` | `shebang` | required source preamble | | `encoding` | `python` | `# -*- coding: utf-8 -*-` | `encoding` | required source preamble | | `sourceMappingURL` | `javascript` | `//# sourceMappingURL=bundle.js.map` | `directive` | tool or language directive | diff --git a/ocaml/lib/ocomment_ref.ml b/ocaml/lib/ocomment_ref.ml index f6647a5..1fa3c89 100644 --- a/ocaml/lib/ocomment_ref.ml +++ b/ocaml/lib/ocomment_ref.ml @@ -589,8 +589,31 @@ let bundler_directive compact = in webpack || opens_with_keyword compact "vite-ignore" +(** A mise file task's header line: "#" or "//", optional whitespace, then "MISE" or "USAGE", bare or in square brackets, ending at whitespace or at the end of the comment. + mise and the usage library it hands argument lines to both match the raw line case-sensitively, so this is asked of [raw] rather than of the folded text, and "# mise installs the runtime" stays prose. + A file task is any executable file, so every language is asked. *) +let mise_task_header raw = + let length = String.length raw in + let after_marker = + if String.starts_with ~prefix:"#" raw then Some 1 + else if String.starts_with ~prefix:"//" raw then Some 2 + else None in + match after_marker with + | None -> false + | Some index -> + let rec skip cursor = + if cursor < length && ascii_whitespace raw.[cursor] then skip (cursor + 1) else cursor in + let start = skip index in + let rest = String.sub raw start (length - start) in + List.exists (fun word -> + let size = String.length word in + String.starts_with ~prefix:word rest && + (String.length rest = size || ascii_whitespace rest.[size])) + ["MISE"; "[MISE]"; "USAGE"; "[USAGE]"] + let is_directive language text raw = let compact = directive_compact text in + mise_task_header raw || let prefixes = ["sourcemappingurl="; "sourceurl="; "#__pure__"; "@__pure__"; "__pure__"; "#__no_side_effects__"; "__no_side_effects__"; "ts-ignore"; "ts-expect-error"; "ts-nocheck"; "ts-check"; "eslint"; "prettier-ignore"; @@ -736,6 +759,8 @@ let bundler_is_load_bearing compact = let is_load_bearing language text raw = let compact = directive_compact text in + (* NOTE: A mise task's header decides what the task runs and which arguments it takes, so removing one changes the task rather than a report about it; asked of every language, as [is_directive] asks it. *) + mise_task_header raw || match language with (* NOTE: The same distinction as in [directive_name], and it has to be made again here because this decides load-bearing from the text rather than from the directive name the other one returned. A spaced "// go:generate" is prose, and prose no policy can reach is worse than prose that stays. *) diff --git a/rust/ocomment-core/src/scanner.rs b/rust/ocomment-core/src/scanner.rs index 4fe541f..9609a35 100644 --- a/rust/ocomment-core/src/scanner.rs +++ b/rust/ocomment-core/src/scanner.rs @@ -6094,6 +6094,11 @@ const fn protected_reason(kind: CommentKind) -> Option<&'static str> { /// The namespace is the compiler's, `//go:generate` is the only member of it a project could argue is bookkeeping, and the argument is not worth the asymmetry: a marker protected in error is one comment left behind that `--force-protected` takes away, while a marker missed in error is a silent change to the build. /// Protect generously, and say why. fn is_load_bearing(name: &str, language: Language) -> bool { + /* NOTE: A mise file task's header is the task's own definition: `#MISE depends=` and `dir=` decide what runs and where, and `#USAGE flag` declares an argument the task accepts, so a task stripped of one still runs and no longer does what it did. + * That is the toolchain's output changing rather than a report, and it is asked of every language because a file task can be written in any of them. */ + if matches!(name, "MISE" | "USAGE") { + return true; + } match language { /* NOTE: `//go:build` and its retired `// +build` twin decide whether the file is compiled at all, `//go:embed` decides what a variable holds, and `//go:noescape` and its neighbours decide what the compiler is allowed to assume. */ Language::Go => matches!(name, "go:" | "+build"), @@ -6929,6 +6934,9 @@ fn go_directive(compact: &str, raw: &[u8]) -> Option<&'static str> { } fn directive_name(text: &str, language: Language, raw: &[u8]) -> Option<&'static str> { + if let Some(name) = mise_task_header(raw) { + return Some(name); + } let compact = text.trim_start_matches(['!', '/', '*', '#', '@', ' ']); let common = [ "sourcemappingurl=", @@ -7176,6 +7184,34 @@ fn directive_name(text: &str, language: Language, raw: &[u8]) -> Option<&'static } } +/// The header line a mise file task declares itself in, if `raw` is one. +/// +/// mise reads a task's description, dependencies, working directory, environment and arguments out of comments at the head of the script, and the `usage` library it hands the argument lines to reads them the same way. +/// Both match the raw line, case-sensitively: `#` or `//`, optional white space, then `MISE` or `USAGE`, bare or in square brackets (mise 2026.9.12, `^(?:#|//|::)\s*(?:(USAGE|MISE)|\[(USAGE|MISE)\])(.*)$`). +/// So this reads `raw` rather than the folded text, which is what keeps `# mise installs the runtime` and `# Usage: foo` prose. +/// The word ends at white space or at the end of the comment, as the tools' own keywords do in [`opens_with_keyword`]; +/// `::` is a batch file's marker, and no built-in language opens a comment with it. +/// +/// Asked of every language, because a file task is any executable file — shell, Python, Ruby, a Node script — and each writes the header in its own comment marker. +fn mise_task_header(raw: &[u8]) -> Option<&'static str> { + let rest = raw + .strip_prefix(b"#") + .or_else(|| raw.strip_prefix(b"//"))? + .trim_ascii_start(); + [ + (&b"MISE"[..], "MISE"), + (b"[MISE]", "MISE"), + (b"USAGE", "USAGE"), + (b"[USAGE]", "USAGE"), + ] + .into_iter() + .find(|(word, _)| { + rest.strip_prefix(*word) + .is_some_and(|tail| tail.first().is_none_or(u8::is_ascii_whitespace)) + }) + .map(|(_, name)| name) +} + /// Whether `text` opens with `keyword` and then ends it. /// /// A directive named after the tool that reads it — `shellcheck`, `hadolint` — diff --git a/rust/ocomment-core/tests/languages.rs b/rust/ocomment-core/tests/languages.rs index 1b6339c..49eaf59 100644 --- a/rust/ocomment-core/tests/languages.rs +++ b/rust/ocomment-core/tests/languages.rs @@ -534,6 +534,75 @@ fn dockerfile_parser_and_linter_directives_are_protected() { assert_eq!(removable(&report), 3); } +/// A mise file task declares its description, dependencies, working directory and arguments in comments at its head, and mise 2026.9.12 and its `usage` library read them case-sensitively from the raw line: `#` or `//`, optional white space, then `MISE` or `USAGE`, bare or in square brackets. +/// A file task is any executable file, so every language is asked, and removing a line changes what the task runs or accepts, so none of them is reachable by `--policy all`. +/// The same letters in another case, running on past the word, or behind a marker mise does not read are prose. +#[test] +fn mise_task_headers_are_load_bearing_in_every_language() { + let all = ScanOptions { + policy: Policy::All, + ..ScanOptions::default() + }; + let cases: [(Language, &[u8]); 5] = [ + ( + Language::Shell, + b"#MISE description=\"audit\"\n#USAGE flag \"--fix\"\n# [MISE] dir=\"{{cwd}}\"\n#\t[USAGE] arg \"\"\n#MISE\n", + ), + (Language::Python, b"#MISE depends=[\"build\"]\n# USAGE arg \"\"\n"), + (Language::Ruby, b"#MISE description=\"audit\"\n#USAGE flag \"--fix\"\n"), + (Language::JavaScript, b"//MISE description=\"audit\"\n// [USAGE] flag \"--fix\"\n"), + (Language::TypeScript, b"//USAGE flag \"--fix\"\n//[MISE] alias=\"a\"\n"), + ]; + for (language, source) in cases { + let report = scan(source, language, all.clone()); + assert!(report.valid, "{language:?}"); + for comment in &report.comments { + assert_eq!( + comment.kind, + CommentKind::LoadBearing, + "{language:?}: {comment:?}" + ); + assert!(!comment.action().removes(), "{language:?}: {comment:?}"); + } + assert!(!report.comments.is_empty(), "{language:?}"); + } + + let prose = b"# mise installs the runtime\n# Usage: audit [--fix]\n#MISEish note\n##MISE doubled\n# usage flag\n"; + let report = scan(prose, Language::Shell, all.clone()); + assert_eq!(report.comments.len(), 5); + assert_eq!(removable(&report), 5); + + let javascript = b"/// MISE doc\n/* MISE block */\nrun();\n"; + let report = scan(javascript, Language::JavaScript, all); + assert_eq!(removable(&report), 2); +} + +/// The header a dotfiles repository wrote, which `fix --tidy` under `wrap = "sentence"` used to join into one `# MISE` line, so mise read the `#USAGE flag` as part of the description and the task no longer took the flag. +/// A header line is a directive, and a directive ends a paragraph rather than joining one. +#[test] +fn a_sentence_wrap_leaves_a_mise_task_header_alone() { + let source = b"#!/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"; + let options = ScanOptions { + policy: Policy::None, + style: ocomment_core::StyleRules { + wrap: ocomment_core::Wrap::Sentence, + ..Default::default() + }, + ..ScanOptions::default() + }; + let report = scan(source, Language::Shell, options); + assert!(report.valid); + assert!(report.runs.is_empty(), "{:?}", report.runs); + assert!( + report + .comments + .iter() + .all(|comment| !matches!(comment.disposition(), Disposition::Rewrite { .. })), + "{:?}", + report.comments + ); +} + #[test] fn shell_command_substitutions_are_scanned_inside_quotes() { let source = b"value=\"$(printf ok # nested\n)\"\nold=`printf ok # legacy\n`\ntext=\"# opaque\"\n# remove\n"; diff --git a/rust/ocomment/assets/directives.toml b/rust/ocomment/assets/directives.toml index 2c0e805..d2b8174 100644 --- a/rust/ocomment/assets/directives.toml +++ b/rust/ocomment/assets/directives.toml @@ -30,10 +30,14 @@ load_bearing = [ "optimizer-hint", "version-comment", # NOTE: The bundlers': each decides what comes out of the build. "webpack", "vite-ignore", - "#__PURE__", "@__PURE__", "#__NO_SIDE_EFFECTS__" + "#__PURE__", "@__PURE__", "#__NO_SIDE_EFFECTS__", + # NOTE: A mise file task's header: `#MISE` and `#USAGE` define what the task runs and which arguments it takes. + # NOTE: A file task is any executable file, so both are read in every language and no entry below names them. + "MISE", "USAGE" ] # NOTE: Every built-in language answers, an empty list included: surveyed and found to have none is a different claim from nobody having looked. +# NOTE: The mise task header is the one load-bearing marker read in every language, and it is left out of the entries for the reason the cross-language tool markers are left out of `[protected_by_language]`. [load_bearing_by_language] go = ["go:", "+build"] swift = ["swift-tools-version:"] diff --git a/rust/ocomment/assets/selftest-corpus.json b/rust/ocomment/assets/selftest-corpus.json index 6e42ffa..b0a0359 100644 --- a/rust/ocomment/assets/selftest-corpus.json +++ b/rust/ocomment/assets/selftest-corpus.json @@ -1 +1 @@ -{"version":1,"floors":{"cases":593,"expectations":593},"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":"// \r\nvar s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"keep"},{"start":44,"end":51,"kind":"doc-line","action":"remove"},{"start":53,"end":60,"kind":"line","action":"remove"}],"output_utf8":"// \r\nvar s = \"// string\";\r\n\r\n\r\n"}},{"id":"csharp-builtin-all","language":"csharp","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"// \r\nvar s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"remove"},{"start":44,"end":51,"kind":"doc-line","action":"remove"},{"start":53,"end":60,"kind":"line","action":"remove"}],"output_utf8":"\r\nvar s = \"// string\";\r\n\r\n\r\n"}},{"id":"scala-builtin-safe","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//> using scala \"3.3.0\"\nval a = s\"${1 /* in */}\" // line\n/** doc */\nval b = // text\n","expect":{"valid":true,"comments":[{"start":0,"end":23,"kind":"load-bearing","action":"keep"},{"start":38,"end":46,"kind":"block","action":"remove"},{"start":50,"end":57,"kind":"line","action":"remove"},{"start":58,"end":68,"kind":"doc-block","action":"remove"}],"output_utf8":"//> using scala \"3.3.0\"\nval a = s\"${1 }\" \n\nval b = // text\n"}},{"id":"scala-builtin-all","language":"scala","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"val a = \"\"\"a\"\"\"\"\nval b = s\"\"\"${1 // in\n} \"\"\"\n//> using scala \"3\"\nval c = `a//b`\n// line\n","expect":{"valid":true,"comments":[{"start":33,"end":38,"kind":"line","action":"remove"},{"start":45,"end":64,"kind":"load-bearing","action":"keep"},{"start":80,"end":87,"kind":"line","action":"remove"}],"output_utf8":"val a = \"\"\"a\"\"\"\"\nval b = s\"\"\"${1 \n} \"\"\"\n//> using scala \"3\"\nval c = `a//b`\n\n"}},{"id":"vue-builtin-safe","language":"vue","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n\n","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"html-comment","action":"keep"},{"start":35,"end":42,"kind":"block","action":"remove"},{"start":89,"end":94,"kind":"line","action":"remove"},{"start":145,"end":152,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n"}},{"id":"svelte-builtin-safe","language":"svelte","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n

{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\n

b

\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

\n

b

\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 <out\ndata\nEOF\n# remove\n","expect":{"valid":true,"comments":[{"start":23,"end":31,"kind":"line","action":"remove"}],"output_utf8":"cat <out\ndata\nEOF\n\n"}},{"id":"parity-html-tag-name-ends-at-ascii-whitespace","language":"html","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"PHNjcmlwdAs+eC8veTwvc2NyaXB0Pgo=","expect":{"valid":true,"comments":[],"output_base64":"PHNjcmlwdAs+eC8veTwvc2NyaXB0Pgo="}},{"id":"parity-profile-boundary-is-ascii-whitespace","language":"c","operation":"transform-profile","options":{"policy":"standard","layout":"lines"},"profile":{"name":"boundary","extensions":["boundary"],"line_comments":[{"start":"REM","kind":"line","requires_boundary":true}],"block_comments":[],"strings":[]},"source_base64":"eAtSRU0gbm90IGEgY29tbWVudApSRU0gcmVtb3ZlCg==","expect":{"valid":true,"comments":[{"start":20,"end":30,"kind":"line","action":"remove"}],"output_base64":"eAtSRU0gbm90IGEgY29tbWVudAoK"}},{"id":"parity-html-script-hashbang-is-not-a-preamble","language":"html","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n","expect":{"valid":true,"comments":[{"start":21,"end":36,"kind":"html-comment","action":"keep"}],"output_utf8":"\n\n"}},{"id":"yaml-hash-in-plain-scalar","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"url: http://example.test/page#fragment\nname: a#b\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"url: http://example.test/page#fragment\nname: a#b\ndone: 1 \n"}},{"id":"yaml-hash-after-space","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: value # remove\nother: 2\t# remove too\n# a whole line\n","expect":{"valid":true,"comments":[{"start":11,"end":19,"kind":"line","action":"remove"},{"start":29,"end":41,"kind":"line","action":"remove"},{"start":42,"end":56,"kind":"line","action":"remove"}],"output_utf8":"key: value \nother: 2\t\n\n"}},{"id":"yaml-double-quoted-multiline-hash","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"first # not a comment\n second # still not\"\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":58,"end":66,"kind":"line","action":"remove"}],"output_utf8":"key: \"first # not a comment\n second # still not\"\ndone: 1 \n"}},{"id":"yaml-single-quoted-escape","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: 'it''s # not a comment'\nplain: it's fine # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"key: 'it''s # not a comment'\nplain: it's fine \n"}},{"id":"yaml-block-literal-body-hash","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n # not a comment\n echo hi\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"script: |\n # not a comment\n echo hi\ndone: 1 \n"}},{"id":"yaml-block-folded-indent-indicator","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"text: >2\n # not a comment\n still folded\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":51,"end":59,"kind":"line","action":"remove"}],"output_utf8":"text: >2\n # not a comment\n still folded\ndone: 1 \n"}},{"id":"yaml-block-header-comment","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |- # remove\n # not a comment\ndone: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":19,"kind":"line","action":"remove"}],"output_utf8":"script: |- \n # not a comment\ndone: 1\n"}},{"id":"yaml-sequence-item-block-scalar","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"steps:\n - run: |\n echo hi # not a comment\n - run: echo bye # remove\n","expect":{"valid":true,"comments":[{"start":66,"end":74,"kind":"line","action":"remove"}],"output_utf8":"steps:\n - run: |\n echo hi # not a comment\n - run: echo bye \n"}},{"id":"yaml-block-ends-at-document-marker","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"|\n a # not a comment\n---\n# remove\n","expect":{"valid":true,"comments":[{"start":26,"end":34,"kind":"line","action":"remove"}],"output_utf8":"|\n a # not a comment\n---\n\n"}},{"id":"yaml-empty-lines-in-body","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n first\n\n # not a comment\n\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"script: |\n first\n\n # not a comment\n\ndone: 1 \n"}},{"id":"yaml-flow-collection-comment","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"flow: [a,\"b # no\", 'c # no'] # remove\nmap: {x: 1} # remove too\n","expect":{"valid":true,"comments":[{"start":29,"end":37,"kind":"line","action":"remove"},{"start":50,"end":62,"kind":"line","action":"remove"}],"output_utf8":"flow: [a,\"b # no\", 'c # no'] \nmap: {x: 1} \n"}},{"id":"yaml-directive-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"%YAML 1.2\n%TAG !e! tag:example.test,2000:app/\n---\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"%YAML 1.2\n%TAG !e! tag:example.test,2000:app/\n---\nkey: 1 \n"}},{"id":"yaml-language-server-directive","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# yaml-language-server: $schema=https://example.test/schema.json\n# renovate: datasource=docker depName=alpine\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":64,"kind":"directive","action":"keep"},{"start":65,"end":109,"kind":"directive","action":"keep"},{"start":117,"end":125,"kind":"line","action":"remove"}],"output_utf8":"# yaml-language-server: $schema=https://example.test/schema.json\n# renovate: datasource=docker depName=alpine\nkey: 1 \n"}},{"id":"yaml-yamllint-directive","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# yamllint disable-line rule:line-length\n# checkov:skip=CKV_AWS_20:public by design\n# @schema type: string\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"directive","action":"keep"},{"start":41,"end":83,"kind":"directive","action":"keep"},{"start":84,"end":106,"kind":"directive","action":"keep"},{"start":114,"end":122,"kind":"line","action":"remove"}],"output_utf8":"# yamllint disable-line rule:line-length\n# checkov:skip=CKV_AWS_20:public by design\n# @schema type: string\nkey: 1 \n"}},{"id":"yaml-crlf","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"first # no\r\n second\"\r\nscript: |\r\n # no\r\ndone: 1 # remove\r\n","expect":{"valid":true,"comments":[{"start":56,"end":64,"kind":"line","action":"remove"}],"output_utf8":"key: \"first # no\r\n second\"\r\nscript: |\r\n # no\r\ndone: 1 \r\n"}},{"id":"yaml-tabs","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n \t# not a comment\n text\ndone: 1\t# remove\n","expect":{"valid":true,"comments":[{"start":44,"end":52,"kind":"line","action":"remove"}],"output_utf8":"script: |\n \t# not a comment\n text\ndone: 1\t\n"}},{"id":"yaml-unterminated-double-quote","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"unclosed # not a comment\nother: 1 # not one either\n","expect":{"valid":false,"comments":[],"output_utf8":"key: \"unclosed # not a comment\nother: 1 # not one either\n"}},{"id":"yaml-columns-layout","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"key: 1 # remove\nnext: 2\n","expect":{"valid":true,"comments":[{"start":7,"end":15,"kind":"line","action":"remove"}],"output_utf8":"key: 1 \nnext: 2\n"}},{"id":"yaml-compact-layout","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"# alone\nkey: 1 # trailing\nnext: 2\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"line","action":"remove"},{"start":15,"end":25,"kind":"line","action":"remove"}],"output_utf8":"key: 1\nnext: 2\n"}},{"id":"yaml-block-scalar-sequence-entry","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"- |\n # a\n b\n","expect":{"valid":true,"comments":[],"output_utf8":"- |\n # a\n b\n"}},{"id":"yaml-block-scalar-tag","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: !!str |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: !!str |\n # a\n"}},{"id":"yaml-block-scalar-anchor","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: &x |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: &x |\n # a\n"}},{"id":"yaml-block-scalar-explicit-key","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"? |\n # a\n: v\n","expect":{"valid":true,"comments":[],"output_utf8":"? |\n # a\n: v\n"}},{"id":"yaml-block-scalar-nested-sequence","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"- - |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"- - |\n # a\n"}},{"id":"yaml-block-scalar-owner-depth","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k:\n - |\n # a\n # still body\n # end\n","expect":{"valid":true,"comments":[{"start":35,"end":40,"kind":"line","action":"remove"}],"output_utf8":"k:\n - |\n # a\n # still body\n"}},{"id":"yaml-block-scalar-indentation-indicator","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |2\n # body\n","expect":{"valid":true,"comments":[],"output_utf8":"k: |2\n # body\n"}},{"id":"yaml-block-scalar-document-root","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"|\n # body\n","expect":{"valid":true,"comments":[],"output_utf8":"|\n # body\n"}},{"id":"yaml-block-scalar-header-own-line","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key:\n |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key:\n |\n # a\n"}},{"id":"yaml-block-scalar-properties-previous-line","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: !!str\n |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: !!str\n |\n # a\n"}},{"id":"yaml-block-scalar-root-properties","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"!!str |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"!!str |\n # a\n"}},{"id":"yaml-keep-chomp-comment-after-body-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1 \n"}},{"id":"yaml-keep-chomp-comment-after-body-columns","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1 \n"}},{"id":"yaml-keep-chomp-comment-after-body-compact","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n\n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n \n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-columns","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-compact","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"parity-js-html-close-behind-a-byte-order-mark","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"Cu+7vy0tPiBjb21tZW50CnggLS0+IG5vdCBvbmUK","expect":{"valid":true,"comments":[{"start":4,"end":15,"kind":"line","action":"remove"}],"output_base64":"Cu+7vwp4IC0tPiBub3Qgb25lCg=="}},{"id":"parity-js-html-close-behind-a-mark-that-is-not-the-first-byte","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"CiDvu78tLT4gY29tbWVudAo=","expect":{"valid":true,"comments":[{"start":5,"end":16,"kind":"line","action":"remove"}],"output_base64":"CiDvu78K"}},{"id":"parity-ocaml-comment-character-literal-shape","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"(*'\\cr#\"]'*)\n","expect":{"valid":false,"comments":[{"start":0,"end":19,"kind":"block","action":"remove"}],"output_utf8":"(*'\\cr#\"]'*)\n"}},{"id":"php-html-then-php","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"

#not a comment

\n#not a comment

\n\n","expect":{"valid":true,"comments":[{"start":10,"end":19,"kind":"line","action":"remove"}],"output_utf8":"\n"}},{"id":"php-xml-decl-not-open-tag","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n

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\n

x

\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\n

x

\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":"// \nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"keep"},{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"// \nvar a = 1; \n"}},{"id":"csharp-resharper-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// ReSharper disable once UnusedMember.Local\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":44,"kind":"directive","action":"keep"},{"start":56,"end":65,"kind":"line","action":"remove"}],"output_utf8":"// ReSharper disable once UnusedMember.Local\nvar a = 1; \n"}},{"id":"csharp-csharpier-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// csharpier-ignore\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"directive","action":"keep"},{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"// csharpier-ignore\nvar a = 1; \n"}},{"id":"csharp-csx-shebang","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env dotnet-script\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":28,"kind":"shebang","action":"keep"},{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env dotnet-script\nvar a = 1; \n"}},{"id":"csharp-unterminated-verbatim","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"open\nvar b = 2;\n","expect":{"valid":false,"comments":[],"output_utf8":"var s = @\"open\nvar b = 2;\n"}},{"id":"csharp-unterminated-raw","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\nopen\nvar b = 2;\n","expect":{"valid":false,"comments":[],"output_utf8":"var s = \"\"\"\nopen\nvar b = 2;\n"}},{"id":"csharp-unterminated-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open\nvar a = 1;\n","expect":{"valid":false,"comments":[{"start":0,"end":19,"kind":"block","action":"remove"}],"output_utf8":"/* open\nvar a = 1;\n"}},{"id":"csharp-crlf","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nvar a = @\"x\r\ny\";\r\nvar b = \"\"\"\r\nz\r\n\"\"\";\r\n#if A // kept\r\n#endif\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"},{"start":83,"end":92,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nvar a = @\"x\r\ny\";\r\nvar b = \"\"\"\r\nz\r\n\"\"\";\r\n#if A \r\n#endif\r\n\r\n"}},{"id":"csharp-columns","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nvar x = 1; // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":20,"end":31,"kind":"line","action":"remove"}],"output_utf8":" \nvar x = 1; \n"}},{"id":"csharp-compact","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nvar x = 1; // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":20,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var x = 1;\n"}},{"id":"csharp-byte-order-mark-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/I3ByYWdtYSB3YXJuaW5nIGRpc2FibGUgMTU5MSAvLyBhIGNvbW1lbnQKdmFyIGEgPSAxOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":32,"end":44,"kind":"line","action":"remove"},{"start":56,"end":65,"kind":"line","action":"remove"}],"output_base64":"77u/I3ByYWdtYSB3YXJuaW5nIGRpc2FibGUgMTU5MSAKdmFyIGEgPSAxOyAK"}},{"id":"csharp-conditional-section-limitation","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if false\n' not C# at all\n#endif\nvar a = 1; // remove\n","expect":{"valid":false,"comments":[{"start":44,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if false\n' not C# at all\n#endif\nvar a = 1; // remove\n"}},{"id":"python-prefixed-string-in-fstring-expression","language":"python","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"f\"{r\"x\n","expect":{"valid":false,"comments":[]}},{"id":"scala-triple-quote-run","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = \"\"\"a\"\"\"\"\nval b = \"\"\"\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"val a = \"\"\"a\"\"\"\"\nval b = \"\"\"\"\"\"\n\n"}},{"id":"scala-backquoted-identifier","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val `a//b` = 1\nval c = `x /* y */`\n// remove\n","expect":{"valid":true,"comments":[{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"val `a//b` = 1\nval c = `x /* y */`\n\n"}},{"id":"scala-xml-literal-text","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = // text\nval b = \nval c = {x // code\n}\n// remove\n","expect":{"valid":true,"comments":[{"start":34,"end":47,"kind":"html-comment","action":"keep"},{"start":66,"end":73,"kind":"line","action":"remove"},{"start":80,"end":89,"kind":"line","action":"remove"}],"output_utf8":"val a = // text\nval b = \nval c = {x \n}\n\n"}},{"id":"scala-keyword-and-number-strings","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"def f = return\"ok ${1 // not}\"\nval g = 1\"x // not\"\n// remove\n","expect":{"valid":true,"comments":[{"start":51,"end":60,"kind":"line","action":"remove"}],"output_utf8":"def f = return\"ok ${1 // not}\"\nval g = 1\"x // not\"\n\n"}},{"id":"scala-dollar-escape-in-interpolated-string","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = s\"x$\"y\"\nval b = s\"$$lit\"\n// remove\n","expect":{"valid":true,"comments":[{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"val a = s\"x$\"y\"\nval b = s\"$$lit\"\n\n"}},{"id":"scss-protocol-relative-url","language":"css","dialect":"scss","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":".b { background: url(//cdn/x.png) no-repeat }\n// yes\n","expect":{"valid":true,"comments":[{"start":46,"end":52,"kind":"line","action":"remove"}],"output_utf8":".b { background: url(//cdn/x.png) no-repeat }\n\n"}},{"id":"vue-v-pre-raw-text","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"
{{ x // not }}
\n\n","expect":{"valid":true,"comments":[{"start":43,"end":56,"kind":"html-comment","action":"keep"}]}},{"id":"vue-unknown-embedded-language","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n","expect":{"valid":true,"comments":[{"start":57,"end":70,"kind":"html-comment","action":"keep"}]}},{"id":"svelte-line-comment-in-expression","language":"svelte","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":"\n","expect":{"valid":true,"comments":[{"start":51,"end":66,"kind":"block","action":"remove"},{"start":94,"end":108,"kind":"block","action":"remove"},{"start":160,"end":174,"kind":"html-comment","action":"keep"}]}},{"id":"svelte-braced-attribute-regex","language":"svelte","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"{ 1 /* body */ }\n","expect":{"valid":true,"comments":[{"start":56,"end":77,"kind":"block","action":"remove"},{"start":97,"end":112,"kind":"block","action":"remove"},{"start":130,"end":140,"kind":"block","action":"remove"}]}},{"id":"kotlin-quote-run-and-multi-dollar-template","language":"kotlin","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = \"\"\"opaque\"\"\"\"// after run\nval b = $$\"\"\"${ /* opaque */ 1 } $${ run { /* code */ } }\"\"\" // tail\n","expect":{"valid":true,"comments":[{"start":21,"end":33,"kind":"line","action":"remove"},{"start":77,"end":87,"kind":"block","action":"remove"},{"start":95,"end":102,"kind":"line","action":"remove"}]}},{"id":"scala-character-versus-symbol-literal","language":"scala","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"val slash = '/'// after char\nval quote = '\\''// after escape\nval double = '\"'// after double quote\nval symbol = 'name // after symbol\n","expect":{"valid":true,"comments":[{"start":15,"end":28,"kind":"line","action":"remove"},{"start":45,"end":60,"kind":"line","action":"remove"},{"start":77,"end":98,"kind":"line","action":"remove"},{"start":118,"end":133,"kind":"line","action":"remove"}]}},{"id":"markdown-commonmark-boundaries-and-rmd-header","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"before\r \r\n \nnext\n```rust `bad\n// not a Rust fence\n```\n```{r, echo=FALSE}\n# r comment\n```\n","expect":{"valid":true,"comments":[{"start":117,"end":128,"kind":"line","action":"remove"}]}},{"id":"sass-nested-interpolation-single-diagnostic","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"#{#{","expect":{"valid":false,"comments":[]}},{"id":"perl-format-method-is-not-picture-body","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"$obj->format = 1; # after\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"}]}},{"id":"swift-format-ignore-vertical-tab-boundary","language":"swift","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_base64":"Ly8gc3dpZnQtZm9ybWF0LWlnbm9yZQsjZXJyb3Ig","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"directive","action":"keep"}]}},{"id":"sql-version-comment-survives-policy-all","language":"sql","operation":"transform","options":{"policy":"all","layout":"lines","dialect":"mysql"},"source_utf8":"/*!40101 SET NAMES utf8 */;\n-- prose\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"version-comment","action":"keep"},{"start":28,"end":36,"kind":"line","action":"remove"}],"output_utf8":"/*!40101 SET NAMES utf8 */;\n\n"}},{"id":"sql-optimizer-hint-survives-policy-all","language":"sql","operation":"transform","options":{"policy":"all","layout":"lines","dialect":"oracle"},"source_utf8":"select /*+ INDEX(t idx) */ 1 from dual; -- prose\n","expect":{"valid":true,"comments":[{"start":7,"end":26,"kind":"optimizer-hint","action":"keep"},{"start":40,"end":48,"kind":"line","action":"remove"}],"output_utf8":"select /*+ INDEX(t idx) */ 1 from dual; \n"}},{"id":"javascript-webpack-magic-comment-survives-policy-all","language":"javascript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const m = import(/* webpackChunkName: \"x\" */ \"./m\");\n// remove\n","expect":{"valid":true,"comments":[{"start":17,"end":44,"kind":"load-bearing","action":"keep"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"const m = import(/* webpackChunkName: \"x\" */ \"./m\");\n\n"}},{"id":"javascript-vite-ignore-survives-policy-all","language":"javascript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const m = import(/* @vite-ignore */ url);\n// remove\n","expect":{"valid":true,"comments":[{"start":17,"end":35,"kind":"load-bearing","action":"keep"},{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"const m = import(/* @vite-ignore */ url);\n\n"}},{"id":"javascript-bundler-near-misses-are-prose","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* webpackish prose */\n/* webpack prose */\n/* @vite-ignoreish */\n","expect":{"valid":true,"comments":[{"start":0,"end":22,"kind":"block","action":"remove"},{"start":23,"end":42,"kind":"block","action":"remove"},{"start":43,"end":64,"kind":"block","action":"remove"}],"output_utf8":"\n\n\n"}},{"id":"declarative-profile-tiers-under-policy-all","language":"c","operation":"transform-profile","options":{"policy":"all","layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":";;","kind":"line"}],"protected_patterns":[{"contains":"KEEPTOOL","reason":"tool tier"},{"contains":"KEEPBUILD","reason":"build tier","tier":"load-bearing"}]},"source_utf8":";; KEEPTOOL one\n;; KEEPBUILD two\n;; ordinary\n","expect":{"valid":true,"comments":[{"start":0,"end":15,"kind":"directive","action":"remove"},{"start":16,"end":32,"kind":"load-bearing","action":"keep"},{"start":33,"end":44,"kind":"line","action":"remove"}],"output_utf8":"\n;; KEEPBUILD two\n\n"}},{"id":"compact-blank-run-around-a-removed-block","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"import Foundation\n\n// what this is for\n// and what it is not\n\npublic struct P {}\n","expect":{"valid":true,"comments":[{"start":19,"end":38,"kind":"line","action":"remove"},{"start":39,"end":60,"kind":"line","action":"remove"}],"output_utf8":"import Foundation\n\npublic struct P {}\n"}},{"id":"compact-keeps-the-longer-blank-run","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"let a = 1\n\n\n// note\n\nlet b = 2\n","expect":{"valid":true,"comments":[{"start":12,"end":19,"kind":"line","action":"remove"}],"output_utf8":"let a = 1\n\n\nlet b = 2\n"}},{"id":"compact-leaves-a-one-sided-blank-run-alone","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"let a = 1\n// note\n\nlet b = 2\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"}],"output_utf8":"let a = 1\n\nlet b = 2\n"}},{"id":"rust-empty-block-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/**/\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"block","action":"remove"}]}},{"id":"rust-three-stars-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/***/\n","expect":{"valid":true,"comments":[{"start":10,"end":15,"kind":"block","action":"remove"}]}},{"id":"rust-three-stars-with-text-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/*** text */\n","expect":{"valid":true,"comments":[{"start":10,"end":22,"kind":"block","action":"remove"}]}},{"id":"rust-four-slashes-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n//// four slashes\n","expect":{"valid":true,"comments":[{"start":10,"end":27,"kind":"line","action":"remove"}]}},{"id":"rust-three-slashes-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/// one line of documentation\n","expect":{"valid":true,"comments":[{"start":10,"end":39,"kind":"doc-line","action":"keep"}]}},{"id":"rust-bang-slash-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n//! inner documentation\n","expect":{"valid":true,"comments":[{"start":10,"end":33,"kind":"doc-line","action":"keep"}]}},{"id":"rust-two-stars-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/** a real doc */\n","expect":{"valid":true,"comments":[{"start":10,"end":27,"kind":"doc-block","action":"keep"}]}},{"id":"rust-bang-star-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/*! an inner block doc */\n","expect":{"valid":true,"comments":[{"start":10,"end":35,"kind":"doc-block","action":"keep"}]}},{"id":"rust-adversarial-corpus","language":"rust","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"// SPDX-License-Identifier: MIT\n//! Inner doc at the top.\n\n/** A block doc comment. */\npub const A: &str = \"//\";\n\n/// One line of documentation.\npub fn hazards() -> usize {\n let raw_deep = r##\"a \"# inside // and /* here\"##;\n let raw_star = r#\"closing */ inside a raw string\"#;\n let byte = b\"// not a comment\";\n let byte_raw = br#\"// nor this\"#;\n let slash = '/';\n let quote = '\\'';\n let backslash = '\\\\';\n let nul = '\\u{0}';\n let solidus = \"\\u{2F}\\u{2F} escaped slashes\";\n let ends_in_escape = \"trailing \\\\\";\n let lifetime: &'static str = \"//\";\n let nested = 1 /* outer /* inner */ still outer */ + 2;\n let empty = 3 /**/ + 4;\n let stars = 5 /***/ + 6;\n let joined = 7/*x*/+ 8;\n let negate = -/*x*/-9_i32;\n let cast = 10_i32 as/*x*/i32;\n let generic: Vec> = Vec::new();\n let attr = ATTRIBUTED;\n raw_deep.len() + raw_star.len() + byte.len() + byte_raw.len() + solidus.len()\n + ends_in_escape.len() + lifetime.len() + generic.len() + attr.len()\n + usize::try_from(nested + empty + stars + joined + negate.abs() + cast).unwrap_or(0)\n + usize::from(slash == quote || backslash == nul)\n}\n\n#[doc = \"// not a comment either\"]\npub const ATTRIBUTED: &str = \"/* nor this */\";\n\nmacro_rules! holding {\n () => {\n \"// inside a macro body\"\n };\n}\n\n/// The macro's expansion, which is a string and not a comment.\npub fn expanded() -> &'static str {\n holding!()\n}\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"license","action":"remove"},{"start":32,"end":57,"kind":"doc-line","action":"remove"},{"start":59,"end":86,"kind":"doc-block","action":"remove"},{"start":114,"end":144,"kind":"doc-line","action":"remove"},{"start":597,"end":632,"kind":"block","action":"remove"},{"start":656,"end":660,"kind":"block","action":"remove"},{"start":684,"end":689,"kind":"block","action":"remove"},{"start":713,"end":718,"kind":"block","action":"remove"},{"start":741,"end":746,"kind":"block","action":"remove"},{"start":778,"end":783,"kind":"block","action":"remove"},{"start":812,"end":817,"kind":"block","action":"remove"},{"start":1339,"end":1402,"kind":"doc-line","action":"remove"}],"output_utf8":"\npub const A: &str = \"//\";\n\npub fn hazards() -> usize {\n let raw_deep = r##\"a \"# inside // and /* here\"##;\n let raw_star = r#\"closing */ inside a raw string\"#;\n let byte = b\"// not a comment\";\n let byte_raw = br#\"// nor this\"#;\n let slash = '/';\n let quote = '\\'';\n let backslash = '\\\\';\n let nul = '\\u{0}';\n let solidus = \"\\u{2F}\\u{2F} escaped slashes\";\n let ends_in_escape = \"trailing \\\\\";\n let lifetime: &'static str = \"//\";\n let nested = 1 + 2;\n let empty = 3 + 4;\n let stars = 5 + 6;\n let joined = 7 + 8;\n let negate = - -9_i32;\n let cast = 10_i32 as i32;\n let generic: Vec> = Vec::new();\n let attr = ATTRIBUTED;\n raw_deep.len() + raw_star.len() + byte.len() + byte_raw.len() + solidus.len()\n + ends_in_escape.len() + lifetime.len() + generic.len() + attr.len()\n + usize::try_from(nested + empty + stars + joined + negate.abs() + cast).unwrap_or(0)\n + usize::from(slash == quote || backslash == nul)\n}\n\n#[doc = \"// not a comment either\"]\npub const ATTRIBUTED: &str = \"/* nor this */\";\n\nmacro_rules! holding {\n () => {\n \"// inside a macro body\"\n };\n}\n\npub fn expanded() -> &'static str {\n holding!()\n}\n"}},{"id":"allow-rules-tag-length-and-trailing","language":"rust","operation":"scan","options":{"policy":"conservative","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":"remove"},{"start":51,"end":67,"kind":"line","action":"remove"},{"start":97,"end":117,"kind":"line","action":"remove"},{"start":119,"end":127,"kind":"line","action":"remove"}]}},{"id":"allow-rules-tag-crosses-languages","language":"lua","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"]}},"source_utf8":"-- NOTE: a Lua rationale.\nlocal x = 1\n-- plain\n","expect":{"valid":true,"comments":[{"start":0,"end":25,"kind":"line","action":"keep"},{"start":38,"end":46,"kind":"line","action":"remove"}]}},{"id":"allow-rules-a-blank-line-ends-a-run","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"],"max_lines":1}},"source_utf8":"// NOTE: first remark.\n\n// NOTE: second remark.\nfn a() {}\n\n// NOTE: third\n// NOTE: and fourth.\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":22,"kind":"line","action":"keep"},{"start":24,"end":47,"kind":"line","action":"keep"},{"start":59,"end":73,"kind":"line","action":"remove"},{"start":74,"end":94,"kind":"line","action":"remove"}]}},{"id":"allow-rules-a-tag-is-a-word-not-a-prefix","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"]}},"source_utf8":"// NOTE: a rationale.\nfn a() {}\n// NOTEBOOK entry\nfn b() {}\n// NOTE\nfn c() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"line","action":"keep"},{"start":32,"end":49,"kind":"line","action":"remove"},{"start":60,"end":67,"kind":"line","action":"keep"}]}},{"id":"allow-rules-a-tag-with-a-deadline-is-an-allowed-tag","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"],"expiry":{"TODO":"14d"}}},"source_utf8":"// NOTE: a rationale.\nfn a() {}\n// TODO: a promise.\nfn b() {}\n// plain\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"line","action":"keep"},{"start":32,"end":51,"kind":"line","action":"keep"},{"start":62,"end":70,"kind":"line","action":"remove"}]}},{"id":"allow-rules-shape-rules-do-not-reach-a-directive-or-a-named-comment","language":"python","operation":"scan","options":{"policy":"conservative","keep_regex":["^# pinned "],"allow":{"max_lines":1,"trailing":false}},"source_utf8":"x = 1 # noqa: E501\ny = 2 # pinned by the updater\nz = 3 # an aside\n","expect":{"valid":true,"comments":[{"start":7,"end":19,"kind":"directive","action":"keep"},{"start":27,"end":50,"kind":"line","action":"keep"},{"start":58,"end":68,"kind":"line","action":"remove"}]}},{"id":"policy-protected-claims-a-projects-own-directives","language":"rust","operation":"scan","options":{"policy":"all","protected":[{"contains":"rust-mutants:","reason":"read by the mutation tester","tier":"load-bearing"},{"contains":"my-linter:","reason":"read by our linter"}]},"source_utf8":"// rust-mutants: skip\nfn a() {}\n// my-linter: allow\nfn b() {}\n// ordinary\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"load-bearing","action":"keep"},{"start":32,"end":51,"kind":"directive","action":"remove"},{"start":62,"end":73,"kind":"line","action":"remove"}]}},{"id":"policy-none-keeps-an-ordinary-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines"},"source_utf8":"let x = 1; // note\n","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"keep"}],"output_utf8":"let x = 1; // note\n"}},{"id":"policy-none-keeps-every-kind","language":"python","operation":"transform","options":{"policy":"none","layout":"lines"},"source_utf8":"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# SPDX-License-Identifier: MIT\n# noqa\n# plain\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"shebang","action":"keep"},{"start":22,"end":45,"kind":"encoding","action":"keep"},{"start":46,"end":76,"kind":"license","action":"keep"},{"start":77,"end":83,"kind":"directive","action":"keep"},{"start":84,"end":91,"kind":"line","action":"keep"}],"output_utf8":"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# SPDX-License-Identifier: MIT\n# noqa\n# plain\n"}},{"id":"style-space-after-marker-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//note\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"line","action":"rewrite"}],"output_utf8":"// note\nlet x = 1;\n"}},{"id":"style-space-after-marker-every-marker","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"#note\n","expect":{"valid":true,"comments":[{"start":0,"end":5,"kind":"line","action":"rewrite"}],"output_utf8":"# note\n"}},{"id":"style-space-after-marker-doc-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"///doc\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"rewrite"}],"output_utf8":"/// doc\nfn a() {}\n"}},{"id":"style-space-after-marker-leaves-a-ruler","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"////////\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"keep"}],"output_utf8":"////////\nlet x = 1;\n"}},{"id":"style-space-after-marker-reaches-the-ocaml-doc-opener","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"(**doc*)\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"doc-block","action":"rewrite"}],"output_utf8":"(** doc*)\nlet a = 1\n"}},{"id":"style-space-after-marker-leaves-an-empty-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":2,"kind":"line","action":"keep"}],"output_utf8":"//\nlet x = 1;\n"}},{"id":"style-trailing-whitespace-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"let x = 1; // note \n","expect":{"valid":true,"comments":[{"start":11,"end":21,"kind":"line","action":"rewrite"}],"output_utf8":"let x = 1; // note\n"}},{"id":"style-trailing-whitespace-every-line-of-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"/* one \n * two\t\n */\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"rewrite"}],"output_utf8":"/* one\n * two\n */\nlet x = 1;\n"}},{"id":"style-trailing-whitespace-keeps-crlf","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"/* one \r\n * two \r\n */\r\n","expect":{"valid":true,"comments":[{"start":0,"end":23,"kind":"block","action":"rewrite"}],"output_utf8":"/* one\r\n * two\r\n */\r\n"}},{"id":"style-rules-compose-and-the-first-is-recorded","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true,"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"// note\nlet x = 1;\n"}},{"id":"style-does-not-reach-a-licence-notice","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//SPDX-License-Identifier: MIT\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"license","action":"keep"}],"output_utf8":"//SPDX-License-Identifier: MIT\nlet x = 1;\n"}},{"id":"style-does-not-reach-a-directive","language":"go","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//go:build linux\npackage main\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"load-bearing","action":"keep"}],"output_utf8":"//go:build linux\npackage main\n"}},{"id":"style-does-not-reach-a-shebang","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"#!/bin/sh\necho hi\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"shebang","action":"keep"}],"output_utf8":"#!/bin/sh\necho hi\n"}},{"id":"style-does-not-reach-a-removed-comment","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"space_after_marker":true,"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"remove"}],"output_utf8":"\nlet x = 1;\n"}},{"id":"style-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"///doc\nfn a() {}\n//note\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"rewrite"},{"start":17,"end":23,"kind":"line","action":"remove"}],"output_utf8":"/// doc\nfn a() {}\n\nlet x = 1;\n"}},{"id":"style-under-compact-layout","language":"rust","operation":"transform","options":{"policy":"none","layout":"compact","style":{"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"//note\nlet x = 1;\n"}},{"id":"style-under-columns-layout","language":"rust","operation":"transform","options":{"policy":"none","layout":"columns","style":{"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"//note\nlet x = 1;\n"}},{"id":"style-leaves-an-html-comment-well-formed","language":"html","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"\n

x

\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\n

x

\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-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":596,"expectations":596},"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":"// \r\nvar s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"keep"},{"start":44,"end":51,"kind":"doc-line","action":"remove"},{"start":53,"end":60,"kind":"line","action":"remove"}],"output_utf8":"// \r\nvar s = \"// string\";\r\n\r\n\r\n"}},{"id":"csharp-builtin-all","language":"csharp","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"// \r\nvar s = \"// string\";\r\n/// doc\r\n// line\r\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"remove"},{"start":44,"end":51,"kind":"doc-line","action":"remove"},{"start":53,"end":60,"kind":"line","action":"remove"}],"output_utf8":"\r\nvar s = \"// string\";\r\n\r\n\r\n"}},{"id":"scala-builtin-safe","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//> using scala \"3.3.0\"\nval a = s\"${1 /* in */}\" // line\n/** doc */\nval b = // text\n","expect":{"valid":true,"comments":[{"start":0,"end":23,"kind":"load-bearing","action":"keep"},{"start":38,"end":46,"kind":"block","action":"remove"},{"start":50,"end":57,"kind":"line","action":"remove"},{"start":58,"end":68,"kind":"doc-block","action":"remove"}],"output_utf8":"//> using scala \"3.3.0\"\nval a = s\"${1 }\" \n\nval b = // text\n"}},{"id":"scala-builtin-all","language":"scala","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"val a = \"\"\"a\"\"\"\"\nval b = s\"\"\"${1 // in\n} \"\"\"\n//> using scala \"3\"\nval c = `a//b`\n// line\n","expect":{"valid":true,"comments":[{"start":33,"end":38,"kind":"line","action":"remove"},{"start":45,"end":64,"kind":"load-bearing","action":"keep"},{"start":80,"end":87,"kind":"line","action":"remove"}],"output_utf8":"val a = \"\"\"a\"\"\"\"\nval b = s\"\"\"${1 \n} \"\"\"\n//> using scala \"3\"\nval c = `a//b`\n\n"}},{"id":"vue-builtin-safe","language":"vue","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n\n","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"html-comment","action":"keep"},{"start":35,"end":42,"kind":"block","action":"remove"},{"start":89,"end":94,"kind":"line","action":"remove"},{"start":145,"end":152,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n"}},{"id":"svelte-builtin-safe","language":"svelte","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n

{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\n

b

\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

\n

b

\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 <out\ndata\nEOF\n# remove\n","expect":{"valid":true,"comments":[{"start":23,"end":31,"kind":"line","action":"remove"}],"output_utf8":"cat <out\ndata\nEOF\n\n"}},{"id":"parity-html-tag-name-ends-at-ascii-whitespace","language":"html","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"PHNjcmlwdAs+eC8veTwvc2NyaXB0Pgo=","expect":{"valid":true,"comments":[],"output_base64":"PHNjcmlwdAs+eC8veTwvc2NyaXB0Pgo="}},{"id":"parity-profile-boundary-is-ascii-whitespace","language":"c","operation":"transform-profile","options":{"policy":"standard","layout":"lines"},"profile":{"name":"boundary","extensions":["boundary"],"line_comments":[{"start":"REM","kind":"line","requires_boundary":true}],"block_comments":[],"strings":[]},"source_base64":"eAtSRU0gbm90IGEgY29tbWVudApSRU0gcmVtb3ZlCg==","expect":{"valid":true,"comments":[{"start":20,"end":30,"kind":"line","action":"remove"}],"output_base64":"eAtSRU0gbm90IGEgY29tbWVudAoK"}},{"id":"parity-html-script-hashbang-is-not-a-preamble","language":"html","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n","expect":{"valid":true,"comments":[{"start":21,"end":36,"kind":"html-comment","action":"keep"}],"output_utf8":"\n\n"}},{"id":"yaml-hash-in-plain-scalar","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"url: http://example.test/page#fragment\nname: a#b\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"url: http://example.test/page#fragment\nname: a#b\ndone: 1 \n"}},{"id":"yaml-hash-after-space","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: value # remove\nother: 2\t# remove too\n# a whole line\n","expect":{"valid":true,"comments":[{"start":11,"end":19,"kind":"line","action":"remove"},{"start":29,"end":41,"kind":"line","action":"remove"},{"start":42,"end":56,"kind":"line","action":"remove"}],"output_utf8":"key: value \nother: 2\t\n\n"}},{"id":"yaml-double-quoted-multiline-hash","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"first # not a comment\n second # still not\"\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":58,"end":66,"kind":"line","action":"remove"}],"output_utf8":"key: \"first # not a comment\n second # still not\"\ndone: 1 \n"}},{"id":"yaml-single-quoted-escape","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: 'it''s # not a comment'\nplain: it's fine # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"key: 'it''s # not a comment'\nplain: it's fine \n"}},{"id":"yaml-block-literal-body-hash","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n # not a comment\n echo hi\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"script: |\n # not a comment\n echo hi\ndone: 1 \n"}},{"id":"yaml-block-folded-indent-indicator","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"text: >2\n # not a comment\n still folded\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":51,"end":59,"kind":"line","action":"remove"}],"output_utf8":"text: >2\n # not a comment\n still folded\ndone: 1 \n"}},{"id":"yaml-block-header-comment","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |- # remove\n # not a comment\ndone: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":19,"kind":"line","action":"remove"}],"output_utf8":"script: |- \n # not a comment\ndone: 1\n"}},{"id":"yaml-sequence-item-block-scalar","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"steps:\n - run: |\n echo hi # not a comment\n - run: echo bye # remove\n","expect":{"valid":true,"comments":[{"start":66,"end":74,"kind":"line","action":"remove"}],"output_utf8":"steps:\n - run: |\n echo hi # not a comment\n - run: echo bye \n"}},{"id":"yaml-block-ends-at-document-marker","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"|\n a # not a comment\n---\n# remove\n","expect":{"valid":true,"comments":[{"start":26,"end":34,"kind":"line","action":"remove"}],"output_utf8":"|\n a # not a comment\n---\n\n"}},{"id":"yaml-empty-lines-in-body","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n first\n\n # not a comment\n\ndone: 1 # remove\n","expect":{"valid":true,"comments":[{"start":46,"end":54,"kind":"line","action":"remove"}],"output_utf8":"script: |\n first\n\n # not a comment\n\ndone: 1 \n"}},{"id":"yaml-flow-collection-comment","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"flow: [a,\"b # no\", 'c # no'] # remove\nmap: {x: 1} # remove too\n","expect":{"valid":true,"comments":[{"start":29,"end":37,"kind":"line","action":"remove"},{"start":50,"end":62,"kind":"line","action":"remove"}],"output_utf8":"flow: [a,\"b # no\", 'c # no'] \nmap: {x: 1} \n"}},{"id":"yaml-directive-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"%YAML 1.2\n%TAG !e! tag:example.test,2000:app/\n---\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":57,"end":65,"kind":"line","action":"remove"}],"output_utf8":"%YAML 1.2\n%TAG !e! tag:example.test,2000:app/\n---\nkey: 1 \n"}},{"id":"yaml-language-server-directive","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# yaml-language-server: $schema=https://example.test/schema.json\n# renovate: datasource=docker depName=alpine\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":64,"kind":"directive","action":"keep"},{"start":65,"end":109,"kind":"directive","action":"keep"},{"start":117,"end":125,"kind":"line","action":"remove"}],"output_utf8":"# yaml-language-server: $schema=https://example.test/schema.json\n# renovate: datasource=docker depName=alpine\nkey: 1 \n"}},{"id":"yaml-yamllint-directive","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"# yamllint disable-line rule:line-length\n# checkov:skip=CKV_AWS_20:public by design\n# @schema type: string\nkey: 1 # remove\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"directive","action":"keep"},{"start":41,"end":83,"kind":"directive","action":"keep"},{"start":84,"end":106,"kind":"directive","action":"keep"},{"start":114,"end":122,"kind":"line","action":"remove"}],"output_utf8":"# yamllint disable-line rule:line-length\n# checkov:skip=CKV_AWS_20:public by design\n# @schema type: string\nkey: 1 \n"}},{"id":"yaml-crlf","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"first # no\r\n second\"\r\nscript: |\r\n # no\r\ndone: 1 # remove\r\n","expect":{"valid":true,"comments":[{"start":56,"end":64,"kind":"line","action":"remove"}],"output_utf8":"key: \"first # no\r\n second\"\r\nscript: |\r\n # no\r\ndone: 1 \r\n"}},{"id":"yaml-tabs","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"script: |\n \t# not a comment\n text\ndone: 1\t# remove\n","expect":{"valid":true,"comments":[{"start":44,"end":52,"kind":"line","action":"remove"}],"output_utf8":"script: |\n \t# not a comment\n text\ndone: 1\t\n"}},{"id":"yaml-unterminated-double-quote","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: \"unclosed # not a comment\nother: 1 # not one either\n","expect":{"valid":false,"comments":[],"output_utf8":"key: \"unclosed # not a comment\nother: 1 # not one either\n"}},{"id":"yaml-columns-layout","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"key: 1 # remove\nnext: 2\n","expect":{"valid":true,"comments":[{"start":7,"end":15,"kind":"line","action":"remove"}],"output_utf8":"key: 1 \nnext: 2\n"}},{"id":"yaml-compact-layout","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"# alone\nkey: 1 # trailing\nnext: 2\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"line","action":"remove"},{"start":15,"end":25,"kind":"line","action":"remove"}],"output_utf8":"key: 1\nnext: 2\n"}},{"id":"yaml-block-scalar-sequence-entry","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"- |\n # a\n b\n","expect":{"valid":true,"comments":[],"output_utf8":"- |\n # a\n b\n"}},{"id":"yaml-block-scalar-tag","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: !!str |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: !!str |\n # a\n"}},{"id":"yaml-block-scalar-anchor","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: &x |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: &x |\n # a\n"}},{"id":"yaml-block-scalar-explicit-key","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"? |\n # a\n: v\n","expect":{"valid":true,"comments":[],"output_utf8":"? |\n # a\n: v\n"}},{"id":"yaml-block-scalar-nested-sequence","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"- - |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"- - |\n # a\n"}},{"id":"yaml-block-scalar-owner-depth","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k:\n - |\n # a\n # still body\n # end\n","expect":{"valid":true,"comments":[{"start":35,"end":40,"kind":"line","action":"remove"}],"output_utf8":"k:\n - |\n # a\n # still body\n"}},{"id":"yaml-block-scalar-indentation-indicator","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |2\n # body\n","expect":{"valid":true,"comments":[],"output_utf8":"k: |2\n # body\n"}},{"id":"yaml-block-scalar-document-root","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"|\n # body\n","expect":{"valid":true,"comments":[],"output_utf8":"|\n # body\n"}},{"id":"yaml-block-scalar-header-own-line","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key:\n |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key:\n |\n # a\n"}},{"id":"yaml-block-scalar-properties-previous-line","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"key: !!str\n |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"key: !!str\n |\n # a\n"}},{"id":"yaml-block-scalar-root-properties","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"!!str |\n # a\n","expect":{"valid":true,"comments":[],"output_utf8":"!!str |\n # a\n"}},{"id":"yaml-keep-chomp-comment-after-body-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1 \n"}},{"id":"yaml-keep-chomp-comment-after-body-columns","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1 \n"}},{"id":"yaml-keep-chomp-comment-after-body-compact","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"k: |+\n body\n\n# after\nnext: 1 # yes\n","expect":{"valid":true,"comments":[{"start":14,"end":21,"kind":"line","action":"remove"},{"start":30,"end":35,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n body\n\nnext: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-trail-swallows-sheltered-blanks-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |+\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-keep-chomp-blank-above-the-trail-stays-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |+\n a\n\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":11,"end":14,"kind":"line","action":"remove"}],"output_utf8":"k: |+\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-clip-chomp-trail-comment-takes-its-line-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: |\n a\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":9,"end":12,"kind":"line","action":"remove"}],"output_utf8":"k: |\n a\n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-lines","language":"yaml","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n\n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-columns","language":"yaml","operation":"transform","options":{"policy":"all","layout":"columns"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n \n\nz: 1\n"}},{"id":"yaml-plain-scalar-pipe-opens-no-trail-compact","language":"yaml","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"k: a |+\n# c\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":8,"end":11,"kind":"line","action":"remove"}],"output_utf8":"k: a |+\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-lines","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-columns","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"yaml-keep-chomp-surviving-comment-shelters-the-rest-compact","language":"yaml","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"k: |+\n a\n# c\n\n# yamllint disable\n\nz: 1\n","expect":{"valid":true,"comments":[{"start":10,"end":13,"kind":"line","action":"remove"},{"start":15,"end":33,"kind":"directive","action":"keep"}],"output_utf8":"k: |+\n a\n# yamllint disable\n\nz: 1\n"}},{"id":"parity-js-html-close-behind-a-byte-order-mark","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"Cu+7vy0tPiBjb21tZW50CnggLS0+IG5vdCBvbmUK","expect":{"valid":true,"comments":[{"start":4,"end":15,"kind":"line","action":"remove"}],"output_base64":"Cu+7vwp4IC0tPiBub3Qgb25lCg=="}},{"id":"parity-js-html-close-behind-a-mark-that-is-not-the-first-byte","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"CiDvu78tLT4gY29tbWVudAo=","expect":{"valid":true,"comments":[{"start":5,"end":16,"kind":"line","action":"remove"}],"output_base64":"CiDvu78K"}},{"id":"parity-ocaml-comment-character-literal-shape","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"(*'\\cr#\"]'*)\n","expect":{"valid":false,"comments":[{"start":0,"end":19,"kind":"block","action":"remove"}],"output_utf8":"(*'\\cr#\"]'*)\n"}},{"id":"php-html-then-php","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"

#not a comment

\n#not a comment

\n\n","expect":{"valid":true,"comments":[{"start":10,"end":19,"kind":"line","action":"remove"}],"output_utf8":"\n"}},{"id":"php-xml-decl-not-open-tag","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n

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\n

x

\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\n

x

\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":"// \nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"directive","action":"keep"},{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"// \nvar a = 1; \n"}},{"id":"csharp-resharper-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// ReSharper disable once UnusedMember.Local\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":44,"kind":"directive","action":"keep"},{"start":56,"end":65,"kind":"line","action":"remove"}],"output_utf8":"// ReSharper disable once UnusedMember.Local\nvar a = 1; \n"}},{"id":"csharp-csharpier-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// csharpier-ignore\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"directive","action":"keep"},{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"// csharpier-ignore\nvar a = 1; \n"}},{"id":"csharp-csx-shebang","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env dotnet-script\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":28,"kind":"shebang","action":"keep"},{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env dotnet-script\nvar a = 1; \n"}},{"id":"csharp-unterminated-verbatim","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"open\nvar b = 2;\n","expect":{"valid":false,"comments":[],"output_utf8":"var s = @\"open\nvar b = 2;\n"}},{"id":"csharp-unterminated-raw","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\nopen\nvar b = 2;\n","expect":{"valid":false,"comments":[],"output_utf8":"var s = \"\"\"\nopen\nvar b = 2;\n"}},{"id":"csharp-unterminated-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open\nvar a = 1;\n","expect":{"valid":false,"comments":[{"start":0,"end":19,"kind":"block","action":"remove"}],"output_utf8":"/* open\nvar a = 1;\n"}},{"id":"csharp-crlf","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nvar a = @\"x\r\ny\";\r\nvar b = \"\"\"\r\nz\r\n\"\"\";\r\n#if A // kept\r\n#endif\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"},{"start":83,"end":92,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nvar a = @\"x\r\ny\";\r\nvar b = \"\"\"\r\nz\r\n\"\"\";\r\n#if A \r\n#endif\r\n\r\n"}},{"id":"csharp-columns","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nvar x = 1; // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":20,"end":31,"kind":"line","action":"remove"}],"output_utf8":" \nvar x = 1; \n"}},{"id":"csharp-compact","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nvar x = 1; // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":20,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var x = 1;\n"}},{"id":"csharp-byte-order-mark-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/I3ByYWdtYSB3YXJuaW5nIGRpc2FibGUgMTU5MSAvLyBhIGNvbW1lbnQKdmFyIGEgPSAxOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":32,"end":44,"kind":"line","action":"remove"},{"start":56,"end":65,"kind":"line","action":"remove"}],"output_base64":"77u/I3ByYWdtYSB3YXJuaW5nIGRpc2FibGUgMTU5MSAKdmFyIGEgPSAxOyAK"}},{"id":"csharp-conditional-section-limitation","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if false\n' not C# at all\n#endif\nvar a = 1; // remove\n","expect":{"valid":false,"comments":[{"start":44,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if false\n' not C# at all\n#endif\nvar a = 1; // remove\n"}},{"id":"python-prefixed-string-in-fstring-expression","language":"python","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"f\"{r\"x\n","expect":{"valid":false,"comments":[]}},{"id":"scala-triple-quote-run","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = \"\"\"a\"\"\"\"\nval b = \"\"\"\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"val a = \"\"\"a\"\"\"\"\nval b = \"\"\"\"\"\"\n\n"}},{"id":"scala-backquoted-identifier","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val `a//b` = 1\nval c = `x /* y */`\n// remove\n","expect":{"valid":true,"comments":[{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"val `a//b` = 1\nval c = `x /* y */`\n\n"}},{"id":"scala-xml-literal-text","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = // text\nval b = \nval c = {x // code\n}\n// remove\n","expect":{"valid":true,"comments":[{"start":34,"end":47,"kind":"html-comment","action":"keep"},{"start":66,"end":73,"kind":"line","action":"remove"},{"start":80,"end":89,"kind":"line","action":"remove"}],"output_utf8":"val a = // text\nval b = \nval c = {x \n}\n\n"}},{"id":"scala-keyword-and-number-strings","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"def f = return\"ok ${1 // not}\"\nval g = 1\"x // not\"\n// remove\n","expect":{"valid":true,"comments":[{"start":51,"end":60,"kind":"line","action":"remove"}],"output_utf8":"def f = return\"ok ${1 // not}\"\nval g = 1\"x // not\"\n\n"}},{"id":"scala-dollar-escape-in-interpolated-string","language":"scala","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = s\"x$\"y\"\nval b = s\"$$lit\"\n// remove\n","expect":{"valid":true,"comments":[{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"val a = s\"x$\"y\"\nval b = s\"$$lit\"\n\n"}},{"id":"scss-protocol-relative-url","language":"css","dialect":"scss","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":".b { background: url(//cdn/x.png) no-repeat }\n// yes\n","expect":{"valid":true,"comments":[{"start":46,"end":52,"kind":"line","action":"remove"}],"output_utf8":".b { background: url(//cdn/x.png) no-repeat }\n\n"}},{"id":"vue-v-pre-raw-text","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"
{{ x // not }}
\n\n","expect":{"valid":true,"comments":[{"start":43,"end":56,"kind":"html-comment","action":"keep"}]}},{"id":"vue-unknown-embedded-language","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\n","expect":{"valid":true,"comments":[{"start":57,"end":70,"kind":"html-comment","action":"keep"}]}},{"id":"svelte-line-comment-in-expression","language":"svelte","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":"\n","expect":{"valid":true,"comments":[{"start":51,"end":66,"kind":"block","action":"remove"},{"start":94,"end":108,"kind":"block","action":"remove"},{"start":160,"end":174,"kind":"html-comment","action":"keep"}]}},{"id":"svelte-braced-attribute-regex","language":"svelte","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"{ 1 /* body */ }\n","expect":{"valid":true,"comments":[{"start":56,"end":77,"kind":"block","action":"remove"},{"start":97,"end":112,"kind":"block","action":"remove"},{"start":130,"end":140,"kind":"block","action":"remove"}]}},{"id":"kotlin-quote-run-and-multi-dollar-template","language":"kotlin","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"val a = \"\"\"opaque\"\"\"\"// after run\nval b = $$\"\"\"${ /* opaque */ 1 } $${ run { /* code */ } }\"\"\" // tail\n","expect":{"valid":true,"comments":[{"start":21,"end":33,"kind":"line","action":"remove"},{"start":77,"end":87,"kind":"block","action":"remove"},{"start":95,"end":102,"kind":"line","action":"remove"}]}},{"id":"scala-character-versus-symbol-literal","language":"scala","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"val slash = '/'// after char\nval quote = '\\''// after escape\nval double = '\"'// after double quote\nval symbol = 'name // after symbol\n","expect":{"valid":true,"comments":[{"start":15,"end":28,"kind":"line","action":"remove"},{"start":45,"end":60,"kind":"line","action":"remove"},{"start":77,"end":98,"kind":"line","action":"remove"},{"start":118,"end":133,"kind":"line","action":"remove"}]}},{"id":"markdown-commonmark-boundaries-and-rmd-header","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"before\r \r\n \nnext\n```rust `bad\n// not a Rust fence\n```\n```{r, echo=FALSE}\n# r comment\n```\n","expect":{"valid":true,"comments":[{"start":117,"end":128,"kind":"line","action":"remove"}]}},{"id":"sass-nested-interpolation-single-diagnostic","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"#{#{","expect":{"valid":false,"comments":[]}},{"id":"perl-format-method-is-not-picture-body","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"$obj->format = 1; # after\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"}]}},{"id":"swift-format-ignore-vertical-tab-boundary","language":"swift","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_base64":"Ly8gc3dpZnQtZm9ybWF0LWlnbm9yZQsjZXJyb3Ig","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"directive","action":"keep"}]}},{"id":"sql-version-comment-survives-policy-all","language":"sql","operation":"transform","options":{"policy":"all","layout":"lines","dialect":"mysql"},"source_utf8":"/*!40101 SET NAMES utf8 */;\n-- prose\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"version-comment","action":"keep"},{"start":28,"end":36,"kind":"line","action":"remove"}],"output_utf8":"/*!40101 SET NAMES utf8 */;\n\n"}},{"id":"sql-optimizer-hint-survives-policy-all","language":"sql","operation":"transform","options":{"policy":"all","layout":"lines","dialect":"oracle"},"source_utf8":"select /*+ INDEX(t idx) */ 1 from dual; -- prose\n","expect":{"valid":true,"comments":[{"start":7,"end":26,"kind":"optimizer-hint","action":"keep"},{"start":40,"end":48,"kind":"line","action":"remove"}],"output_utf8":"select /*+ INDEX(t idx) */ 1 from dual; \n"}},{"id":"javascript-webpack-magic-comment-survives-policy-all","language":"javascript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const m = import(/* webpackChunkName: \"x\" */ \"./m\");\n// remove\n","expect":{"valid":true,"comments":[{"start":17,"end":44,"kind":"load-bearing","action":"keep"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"const m = import(/* webpackChunkName: \"x\" */ \"./m\");\n\n"}},{"id":"javascript-vite-ignore-survives-policy-all","language":"javascript","operation":"transform","options":{"policy":"all","layout":"lines"},"source_utf8":"const m = import(/* @vite-ignore */ url);\n// remove\n","expect":{"valid":true,"comments":[{"start":17,"end":35,"kind":"load-bearing","action":"keep"},{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"const m = import(/* @vite-ignore */ url);\n\n"}},{"id":"javascript-bundler-near-misses-are-prose","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* webpackish prose */\n/* webpack prose */\n/* @vite-ignoreish */\n","expect":{"valid":true,"comments":[{"start":0,"end":22,"kind":"block","action":"remove"},{"start":23,"end":42,"kind":"block","action":"remove"},{"start":43,"end":64,"kind":"block","action":"remove"}],"output_utf8":"\n\n\n"}},{"id":"declarative-profile-tiers-under-policy-all","language":"c","operation":"transform-profile","options":{"policy":"all","layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":";;","kind":"line"}],"protected_patterns":[{"contains":"KEEPTOOL","reason":"tool tier"},{"contains":"KEEPBUILD","reason":"build tier","tier":"load-bearing"}]},"source_utf8":";; KEEPTOOL one\n;; KEEPBUILD two\n;; ordinary\n","expect":{"valid":true,"comments":[{"start":0,"end":15,"kind":"directive","action":"remove"},{"start":16,"end":32,"kind":"load-bearing","action":"keep"},{"start":33,"end":44,"kind":"line","action":"remove"}],"output_utf8":"\n;; KEEPBUILD two\n\n"}},{"id":"compact-blank-run-around-a-removed-block","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"import Foundation\n\n// what this is for\n// and what it is not\n\npublic struct P {}\n","expect":{"valid":true,"comments":[{"start":19,"end":38,"kind":"line","action":"remove"},{"start":39,"end":60,"kind":"line","action":"remove"}],"output_utf8":"import Foundation\n\npublic struct P {}\n"}},{"id":"compact-keeps-the-longer-blank-run","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"let a = 1\n\n\n// note\n\nlet b = 2\n","expect":{"valid":true,"comments":[{"start":12,"end":19,"kind":"line","action":"remove"}],"output_utf8":"let a = 1\n\n\nlet b = 2\n"}},{"id":"compact-leaves-a-one-sided-blank-run-alone","language":"swift","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"let a = 1\n// note\n\nlet b = 2\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"}],"output_utf8":"let a = 1\n\nlet b = 2\n"}},{"id":"rust-empty-block-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/**/\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"block","action":"remove"}]}},{"id":"rust-three-stars-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/***/\n","expect":{"valid":true,"comments":[{"start":10,"end":15,"kind":"block","action":"remove"}]}},{"id":"rust-three-stars-with-text-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/*** text */\n","expect":{"valid":true,"comments":[{"start":10,"end":22,"kind":"block","action":"remove"}]}},{"id":"rust-four-slashes-is-not-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n//// four slashes\n","expect":{"valid":true,"comments":[{"start":10,"end":27,"kind":"line","action":"remove"}]}},{"id":"rust-three-slashes-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/// one line of documentation\n","expect":{"valid":true,"comments":[{"start":10,"end":39,"kind":"doc-line","action":"keep"}]}},{"id":"rust-bang-slash-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n//! inner documentation\n","expect":{"valid":true,"comments":[{"start":10,"end":33,"kind":"doc-line","action":"keep"}]}},{"id":"rust-two-stars-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/** a real doc */\n","expect":{"valid":true,"comments":[{"start":10,"end":27,"kind":"doc-block","action":"keep"}]}},{"id":"rust-bang-star-is-documentation","language":"rust","operation":"scan","options":{"policy":"conservative"},"source_utf8":"fn f() {}\n/*! an inner block doc */\n","expect":{"valid":true,"comments":[{"start":10,"end":35,"kind":"doc-block","action":"keep"}]}},{"id":"rust-adversarial-corpus","language":"rust","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"// SPDX-License-Identifier: MIT\n//! Inner doc at the top.\n\n/** A block doc comment. */\npub const A: &str = \"//\";\n\n/// One line of documentation.\npub fn hazards() -> usize {\n let raw_deep = r##\"a \"# inside // and /* here\"##;\n let raw_star = r#\"closing */ inside a raw string\"#;\n let byte = b\"// not a comment\";\n let byte_raw = br#\"// nor this\"#;\n let slash = '/';\n let quote = '\\'';\n let backslash = '\\\\';\n let nul = '\\u{0}';\n let solidus = \"\\u{2F}\\u{2F} escaped slashes\";\n let ends_in_escape = \"trailing \\\\\";\n let lifetime: &'static str = \"//\";\n let nested = 1 /* outer /* inner */ still outer */ + 2;\n let empty = 3 /**/ + 4;\n let stars = 5 /***/ + 6;\n let joined = 7/*x*/+ 8;\n let negate = -/*x*/-9_i32;\n let cast = 10_i32 as/*x*/i32;\n let generic: Vec> = Vec::new();\n let attr = ATTRIBUTED;\n raw_deep.len() + raw_star.len() + byte.len() + byte_raw.len() + solidus.len()\n + ends_in_escape.len() + lifetime.len() + generic.len() + attr.len()\n + usize::try_from(nested + empty + stars + joined + negate.abs() + cast).unwrap_or(0)\n + usize::from(slash == quote || backslash == nul)\n}\n\n#[doc = \"// not a comment either\"]\npub const ATTRIBUTED: &str = \"/* nor this */\";\n\nmacro_rules! holding {\n () => {\n \"// inside a macro body\"\n };\n}\n\n/// The macro's expansion, which is a string and not a comment.\npub fn expanded() -> &'static str {\n holding!()\n}\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"license","action":"remove"},{"start":32,"end":57,"kind":"doc-line","action":"remove"},{"start":59,"end":86,"kind":"doc-block","action":"remove"},{"start":114,"end":144,"kind":"doc-line","action":"remove"},{"start":597,"end":632,"kind":"block","action":"remove"},{"start":656,"end":660,"kind":"block","action":"remove"},{"start":684,"end":689,"kind":"block","action":"remove"},{"start":713,"end":718,"kind":"block","action":"remove"},{"start":741,"end":746,"kind":"block","action":"remove"},{"start":778,"end":783,"kind":"block","action":"remove"},{"start":812,"end":817,"kind":"block","action":"remove"},{"start":1339,"end":1402,"kind":"doc-line","action":"remove"}],"output_utf8":"\npub const A: &str = \"//\";\n\npub fn hazards() -> usize {\n let raw_deep = r##\"a \"# inside // and /* here\"##;\n let raw_star = r#\"closing */ inside a raw string\"#;\n let byte = b\"// not a comment\";\n let byte_raw = br#\"// nor this\"#;\n let slash = '/';\n let quote = '\\'';\n let backslash = '\\\\';\n let nul = '\\u{0}';\n let solidus = \"\\u{2F}\\u{2F} escaped slashes\";\n let ends_in_escape = \"trailing \\\\\";\n let lifetime: &'static str = \"//\";\n let nested = 1 + 2;\n let empty = 3 + 4;\n let stars = 5 + 6;\n let joined = 7 + 8;\n let negate = - -9_i32;\n let cast = 10_i32 as i32;\n let generic: Vec> = Vec::new();\n let attr = ATTRIBUTED;\n raw_deep.len() + raw_star.len() + byte.len() + byte_raw.len() + solidus.len()\n + ends_in_escape.len() + lifetime.len() + generic.len() + attr.len()\n + usize::try_from(nested + empty + stars + joined + negate.abs() + cast).unwrap_or(0)\n + usize::from(slash == quote || backslash == nul)\n}\n\n#[doc = \"// not a comment either\"]\npub const ATTRIBUTED: &str = \"/* nor this */\";\n\nmacro_rules! holding {\n () => {\n \"// inside a macro body\"\n };\n}\n\npub fn expanded() -> &'static str {\n holding!()\n}\n"}},{"id":"allow-rules-tag-length-and-trailing","language":"rust","operation":"scan","options":{"policy":"conservative","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":"remove"},{"start":51,"end":67,"kind":"line","action":"remove"},{"start":97,"end":117,"kind":"line","action":"remove"},{"start":119,"end":127,"kind":"line","action":"remove"}]}},{"id":"allow-rules-tag-crosses-languages","language":"lua","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"]}},"source_utf8":"-- NOTE: a Lua rationale.\nlocal x = 1\n-- plain\n","expect":{"valid":true,"comments":[{"start":0,"end":25,"kind":"line","action":"keep"},{"start":38,"end":46,"kind":"line","action":"remove"}]}},{"id":"allow-rules-a-blank-line-ends-a-run","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"],"max_lines":1}},"source_utf8":"// NOTE: first remark.\n\n// NOTE: second remark.\nfn a() {}\n\n// NOTE: third\n// NOTE: and fourth.\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":22,"kind":"line","action":"keep"},{"start":24,"end":47,"kind":"line","action":"keep"},{"start":59,"end":73,"kind":"line","action":"remove"},{"start":74,"end":94,"kind":"line","action":"remove"}]}},{"id":"allow-rules-a-tag-is-a-word-not-a-prefix","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"]}},"source_utf8":"// NOTE: a rationale.\nfn a() {}\n// NOTEBOOK entry\nfn b() {}\n// NOTE\nfn c() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"line","action":"keep"},{"start":32,"end":49,"kind":"line","action":"remove"},{"start":60,"end":67,"kind":"line","action":"keep"}]}},{"id":"allow-rules-a-tag-with-a-deadline-is-an-allowed-tag","language":"rust","operation":"scan","options":{"policy":"conservative","allow":{"tags":["NOTE"],"expiry":{"TODO":"14d"}}},"source_utf8":"// NOTE: a rationale.\nfn a() {}\n// TODO: a promise.\nfn b() {}\n// plain\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"line","action":"keep"},{"start":32,"end":51,"kind":"line","action":"keep"},{"start":62,"end":70,"kind":"line","action":"remove"}]}},{"id":"allow-rules-shape-rules-do-not-reach-a-directive-or-a-named-comment","language":"python","operation":"scan","options":{"policy":"conservative","keep_regex":["^# pinned "],"allow":{"max_lines":1,"trailing":false}},"source_utf8":"x = 1 # noqa: E501\ny = 2 # pinned by the updater\nz = 3 # an aside\n","expect":{"valid":true,"comments":[{"start":7,"end":19,"kind":"directive","action":"keep"},{"start":27,"end":50,"kind":"line","action":"keep"},{"start":58,"end":68,"kind":"line","action":"remove"}]}},{"id":"policy-protected-claims-a-projects-own-directives","language":"rust","operation":"scan","options":{"policy":"all","protected":[{"contains":"rust-mutants:","reason":"read by the mutation tester","tier":"load-bearing"},{"contains":"my-linter:","reason":"read by our linter"}]},"source_utf8":"// rust-mutants: skip\nfn a() {}\n// my-linter: allow\nfn b() {}\n// ordinary\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"load-bearing","action":"keep"},{"start":32,"end":51,"kind":"directive","action":"remove"},{"start":62,"end":73,"kind":"line","action":"remove"}]}},{"id":"policy-none-keeps-an-ordinary-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines"},"source_utf8":"let x = 1; // note\n","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"keep"}],"output_utf8":"let x = 1; // note\n"}},{"id":"policy-none-keeps-every-kind","language":"python","operation":"transform","options":{"policy":"none","layout":"lines"},"source_utf8":"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# SPDX-License-Identifier: MIT\n# noqa\n# plain\n","expect":{"valid":true,"comments":[{"start":0,"end":21,"kind":"shebang","action":"keep"},{"start":22,"end":45,"kind":"encoding","action":"keep"},{"start":46,"end":76,"kind":"license","action":"keep"},{"start":77,"end":83,"kind":"directive","action":"keep"},{"start":84,"end":91,"kind":"line","action":"keep"}],"output_utf8":"#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n# SPDX-License-Identifier: MIT\n# noqa\n# plain\n"}},{"id":"style-space-after-marker-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//note\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"line","action":"rewrite"}],"output_utf8":"// note\nlet x = 1;\n"}},{"id":"style-space-after-marker-every-marker","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"#note\n","expect":{"valid":true,"comments":[{"start":0,"end":5,"kind":"line","action":"rewrite"}],"output_utf8":"# note\n"}},{"id":"style-space-after-marker-doc-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"///doc\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"rewrite"}],"output_utf8":"/// doc\nfn a() {}\n"}},{"id":"style-space-after-marker-leaves-a-ruler","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"////////\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"keep"}],"output_utf8":"////////\nlet x = 1;\n"}},{"id":"style-space-after-marker-reaches-the-ocaml-doc-opener","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"(**doc*)\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"doc-block","action":"rewrite"}],"output_utf8":"(** doc*)\nlet a = 1\n"}},{"id":"style-space-after-marker-leaves-an-empty-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":2,"kind":"line","action":"keep"}],"output_utf8":"//\nlet x = 1;\n"}},{"id":"style-trailing-whitespace-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"let x = 1; // note \n","expect":{"valid":true,"comments":[{"start":11,"end":21,"kind":"line","action":"rewrite"}],"output_utf8":"let x = 1; // note\n"}},{"id":"style-trailing-whitespace-every-line-of-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"/* one \n * two\t\n */\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"rewrite"}],"output_utf8":"/* one\n * two\n */\nlet x = 1;\n"}},{"id":"style-trailing-whitespace-keeps-crlf","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"trailing_whitespace":false}},"source_utf8":"/* one \r\n * two \r\n */\r\n","expect":{"valid":true,"comments":[{"start":0,"end":23,"kind":"block","action":"rewrite"}],"output_utf8":"/* one\r\n * two\r\n */\r\n"}},{"id":"style-rules-compose-and-the-first-is-recorded","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true,"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"// note\nlet x = 1;\n"}},{"id":"style-does-not-reach-a-licence-notice","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//SPDX-License-Identifier: MIT\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"license","action":"keep"}],"output_utf8":"//SPDX-License-Identifier: MIT\nlet x = 1;\n"}},{"id":"style-does-not-reach-a-directive","language":"go","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"//go:build linux\npackage main\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"load-bearing","action":"keep"}],"output_utf8":"//go:build linux\npackage main\n"}},{"id":"style-does-not-reach-a-shebang","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"#!/bin/sh\necho hi\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"shebang","action":"keep"}],"output_utf8":"#!/bin/sh\necho hi\n"}},{"id":"style-does-not-reach-a-removed-comment","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"space_after_marker":true,"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"remove"}],"output_utf8":"\nlet x = 1;\n"}},{"id":"style-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"///doc\nfn a() {}\n//note\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"rewrite"},{"start":17,"end":23,"kind":"line","action":"remove"}],"output_utf8":"/// doc\nfn a() {}\n\nlet x = 1;\n"}},{"id":"style-under-compact-layout","language":"rust","operation":"transform","options":{"policy":"none","layout":"compact","style":{"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"//note\nlet x = 1;\n"}},{"id":"style-under-columns-layout","language":"rust","operation":"transform","options":{"policy":"none","layout":"columns","style":{"trailing_whitespace":false}},"source_utf8":"//note \nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":0,"end":9,"kind":"line","action":"rewrite"}],"output_utf8":"//note\nlet x = 1;\n"}},{"id":"style-leaves-an-html-comment-well-formed","language":"html","operation":"transform","options":{"policy":"none","layout":"lines","style":{"space_after_marker":true}},"source_utf8":"\n

x

\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\n

x

\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/spec/directives.toml b/spec/directives.toml index 2c0e805..d2b8174 100644 --- a/spec/directives.toml +++ b/spec/directives.toml @@ -30,10 +30,14 @@ load_bearing = [ "optimizer-hint", "version-comment", # NOTE: The bundlers': each decides what comes out of the build. "webpack", "vite-ignore", - "#__PURE__", "@__PURE__", "#__NO_SIDE_EFFECTS__" + "#__PURE__", "@__PURE__", "#__NO_SIDE_EFFECTS__", + # NOTE: A mise file task's header: `#MISE` and `#USAGE` define what the task runs and which arguments it takes. + # NOTE: A file task is any executable file, so both are read in every language and no entry below names them. + "MISE", "USAGE" ] # NOTE: Every built-in language answers, an empty list included: surveyed and found to have none is a different claim from nobody having looked. +# NOTE: The mise task header is the one load-bearing marker read in every language, and it is left out of the entries for the reason the cross-language tool markers are left out of `[protected_by_language]`. [load_bearing_by_language] go = ["go:", "+build"] swift = ["swift-tools-version:"] diff --git a/spec/fixtures/v1/floor.txt b/spec/fixtures/v1/floor.txt index 078b9c0..109575c 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 593 -expectations 593 +cases 596 +expectations 596 diff --git a/spec/fixtures/v1/hazards.json b/spec/fixtures/v1/hazards.json index 0f58f6d..19ce8a8 100644 --- a/spec/fixtures/v1/hazards.json +++ b/spec/fixtures/v1/hazards.json @@ -1209,6 +1209,126 @@ "output_utf8": "# syntax=docker/dockerfile:1\n\n# hadolint ignore=DL3018\n# hadolint\tignore=DL3019\n\nRUN apk add --no-cache musl-dev\n# shellcheck disable=SC2086\n# shellcheck\tdisable=SC2087\n\n" } }, + { + "id": "mise-task-header-survives-every-policy", + "language": "shell", + "operation": "transform", + "options": { + "policy": "all", + "layout": "lines" + }, + "source_utf8": "#!/usr/bin/env bash\n#MISE description=\"Audit the signing posture\"\n#USAGE flag \"--fix\" help=\"Repair what the audit finds\"\n# [MISE] dir=\"{{cwd}}\"\n#\t[USAGE] arg \"\"\n#MISE\n#MISEish note\n##MISE doubled marker\n# mise installs the runtime\n# Usage: audit [--fix]\necho audit\n", + "note": "mise reads a file task's configuration out of its header, and mise 2026.9.12 and its usage library match the raw line case-sensitively: `#` or `//`, optional whitespace, then `MISE` or `USAGE`, bare or in square brackets. `#MISE depends=` and `dir=` decide what runs and `#USAGE flag` declares an argument the task accepts, so the header is load-bearing and even `--policy all` keeps it. The word ends at whitespace or at the end of the comment, and prose that opens with the same letters in another case, a word running on past them, or a second `#` is an ordinary comment.", + "expect": { + "valid": true, + "comments": [ + { + "start": 0, + "end": 19, + "kind": "shebang", + "action": "keep" + }, + { + "start": 20, + "end": 65, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 66, + "end": 120, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 121, + "end": 143, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 144, + "end": 166, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 167, + "end": 172, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 173, + "end": 186, + "kind": "line", + "action": "remove" + }, + { + "start": 187, + "end": 208, + "kind": "line", + "action": "remove" + }, + { + "start": 209, + "end": 236, + "kind": "line", + "action": "remove" + }, + { + "start": 237, + "end": 259, + "kind": "line", + "action": "remove" + } + ], + "diagnostics": [], + "output_utf8": "#!/usr/bin/env bash\n#MISE description=\"Audit the signing posture\"\n#USAGE flag \"--fix\" help=\"Repair what the audit finds\"\n# [MISE] dir=\"{{cwd}}\"\n#\t[USAGE] arg \"\"\n#MISE\n\n\n\n\necho audit\n" + } + }, + { + "id": "mise-task-header-in-javascript", + "language": "javascript", + "operation": "transform", + "options": { + "policy": "all", + "layout": "lines" + }, + "source_utf8": "//MISE description=\"Audit the signing posture\"\n// USAGE flag \"--fix\"\n/// MISE is not read behind a third slash\n/* MISE is not read in a block comment */\nrun();\n", + "note": "A mise file task is any executable file, so the header is recognised in every language, written with `//` as mise reads it. A third slash is not whitespace and a block comment is not a line mise reads, so neither is a header.", + "expect": { + "valid": true, + "comments": [ + { + "start": 0, + "end": 46, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 47, + "end": 68, + "kind": "load-bearing", + "action": "keep" + }, + { + "start": 69, + "end": 110, + "kind": "doc-line", + "action": "remove" + }, + { + "start": 111, + "end": 152, + "kind": "block", + "action": "remove" + } + ], + "diagnostics": [], + "output_utf8": "//MISE description=\"Audit the signing posture\"\n// USAGE flag \"--fix\"\n\n\nrun();\n" + } + }, { "id": "shell-case-command-substitution", "language": "shell", @@ -15824,6 +15944,57 @@ "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", + "note": "The header of a mise file task, as a dotfiles repository wrote it. Read as prose, the two header lines were joined into one `# MISE` line and the reflow wrote a space after the `#`, so mise read a single MISE line and the `--fix-stale-hooks` flag was no longer declared. Each header line is a directive, and a directive ends a paragraph rather than joining one.", + "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" + } + ], + "diagnostics": [], + "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", diff --git a/tools/check_directives.py b/tools/check_directives.py index dabf9b9..909afb1 100644 --- a/tools/check_directives.py +++ b/tools/check_directives.py @@ -259,6 +259,24 @@ def source(self, comment: str) -> bytes: "# a note about syntax=docker/dockerfile:1", KEPT_AS_LOAD_BEARING, ), + # NOTE: A mise file task's header, which mise and the `usage` library read case-sensitively from the raw line. + # NOTE: Each near-miss is the same word in the case prose writes it in, which is the boundary the raw-byte match exists to hold. + "MISE": Sample( + "shell", + None, + f"{SLOT}\n# control\n", + '#MISE description="Audit the signing posture"', + "# mise installs the runtime this task needs", + KEPT_AS_LOAD_BEARING, + ), + "USAGE": Sample( + "javascript", + None, + f"{SLOT}\n// control\n", + '//USAGE flag "--fix" help="Repair what the audit finds"', + "// Usage: node audit.js [--fix]", + KEPT_AS_LOAD_BEARING, + ), "hadolint": Sample( "shell", None, diff --git a/tools/fuzz_differential.py b/tools/fuzz_differential.py index 2b6768b..e07c6d7 100755 --- a/tools/fuzz_differential.py +++ b/tools/fuzz_differential.py @@ -123,6 +123,7 @@ "eslint-disable", "prettier-ignore", "region", "endregion", "noqa", ":schema", "taplo:", "luacheck:", "---@diagnostic", "go:generate", "yamllint", "@schema", "yaml-language-server:", + "MISE", "USAGE", "[MISE]", "[USAGE]", "mise", "MISEish", "Copyright (c) 2020", "SPDX-License-Identifier: MIT", "@license", "NOTE:", "coding: utf-8", "pragma once", ] diff --git a/tools/gen_docs.py b/tools/gen_docs.py index faa56c5..8f173dd 100644 --- a/tools/gen_docs.py +++ b/tools/gen_docs.py @@ -93,6 +93,8 @@ "optimizer-hint": ("sql", "oracle", b"select /*+ index(t) */ 1 from dual;\n"), "version-comment": ("sql", "mysql", b"/*!40101 SET NAMES utf8 */\n"), "syntax=": ("shell", None, b"# syntax=docker/dockerfile:1\n"), + "MISE": ("shell", None, b'#MISE description="Audit the signing posture"\n'), + "USAGE": ("shell", None, b'#USAGE flag "--fix" help="Repair what the audit finds"\n'), "hadolint": ("shell", None, b"# hadolint ignore=DL3018\n"), ":schema": ("toml", None, b"#:schema https://example.test/pyproject.json\n"), "taplo:": ("toml", None, b"# taplo: array_auto_expand = false\n"), From 89146583c86b6fa8775bb802d1c0572906bfecbc Mon Sep 17 00:00:00 2001 From: Yasunobu <42543015+P4suta@users.noreply.github.com> Date: Thu, 24 Sep 2026 13:05:46 +0900 Subject: [PATCH 2/2] fix(test): keep the suite off a repository the caller's environment names Git exports GIT_DIR and its neighbours to a hook, and the pre-push hook runs `cargo xtask preflight`. Every step inherited them, so from a linked worktree the CLI suite's `git init -q` in a temporary directory reinitialised the shared git directory and left the main checkout with `core.bare = true`. Run the same suite with GIT_DIR pointed anywhere and the ocomment binary it drives follows it too: `check --staged` asked that repository for its index and hung. The suite now builds every git and ocomment process through one helper, `tests/common::isolated`, which drops every inherited `GIT_*` variable. xtask also removes the names `git rev-parse --local-env-vars` lists from every preflight step, so a step that is not a test is kept off the pushed repository too. The binary itself is unchanged: it runs inside hooks and has to honour GIT_DIR. `a_repository_named_by_the_callers_environment_is_left_alone` reruns a repository-building test with GIT_DIR, GIT_WORK_TREE and GIT_INDEX_FILE pointed at a sentinel repository and requires the sentinel's config to be byte-identical afterwards. With the helper's filter disabled it fails; with it, it passes. --- rust/ocomment/tests/cli.rs | 33 +++++++++++++++++++++++---- rust/ocomment/tests/common/mod.rs | 11 +++++++++ rust/ocomment/tests/deadline.rs | 14 +++++------- rust/ocomment/tests/gate.rs | 12 ++++------ rust/ocomment/tests/hook.rs | 6 +++-- rust/ocomment/tests/lsp.rs | 6 +++-- rust/ocomment/tests/review.rs | 9 ++++---- rust/ocomment/tests/spec_languages.rs | 6 +++-- rust/ocomment/tests/trace.rs | 12 ++++++---- rust/xtask/src/main.rs | 21 +++++++++++++++++ 10 files changed, 94 insertions(+), 36 deletions(-) create mode 100644 rust/ocomment/tests/common/mod.rs diff --git a/rust/ocomment/tests/cli.rs b/rust/ocomment/tests/cli.rs index fdd64d4..ed19845 100644 --- a/rust/ocomment/tests/cli.rs +++ b/rust/ocomment/tests/cli.rs @@ -3,6 +3,8 @@ //! Every case here starts a process. //! What a test can see is what a caller can see -- the two streams, the exit status, and the bytes on the disk afterwards -- which is the point: a promise the binary makes is a promise about those and not about a function somewhere inside it. +mod common; + use std::{ collections::BTreeSet, fs, @@ -37,7 +39,7 @@ fn binary() -> &'static str { fn command() -> Command { static EMPTY: std::sync::OnceLock = std::sync::OnceLock::new(); let empty = EMPTY.get_or_init(|| tempfile::tempdir().expect("a temporary directory")); - let mut command = Command::new(binary()); + let mut command = common::isolated(binary()); command.env("XDG_CONFIG_HOME", empty.path()); command } @@ -141,7 +143,7 @@ fn git_program() -> &'static str { } fn git(directory: &Path, arguments: &[&str]) -> Vec { - let output = Command::new(git_program()) + let output = common::isolated(git_program()) .current_dir(directory) .args(arguments) .output() @@ -157,7 +159,7 @@ fn git(directory: &Path, arguments: &[&str]) -> Vec { #[cfg(unix)] fn git_with_path(directory: &Path, arguments: &[&str], path: &std::ffi::OsStr) -> Vec { - let output = Command::new(git_program()) + let output = common::isolated(git_program()) .current_dir(directory) .args(arguments) .arg(path) @@ -224,6 +226,27 @@ fn check_diff_and_fix_follow_the_exit_contract() { ); } +#[test] +#[cfg(unix)] +fn a_repository_named_by_the_callers_environment_is_left_alone() { + let sentinel = tempfile::tempdir().unwrap(); + git(sentinel.path(), &["init", "-q"]); + let config = sentinel.path().join(".git/config"); + let before = fs::read(&config).unwrap(); + + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "a_tidy_and_a_staged_write_both_exit_one"]) + .env("GIT_DIR", sentinel.path().join(".git")) + .env("GIT_WORK_TREE", sentinel.path()) + .env("GIT_INDEX_FILE", sentinel.path().join(".git/index")) + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!(output.status.success(), "{stdout}"); + assert!(stdout.contains("1 passed"), "{stdout}"); + assert_eq!(fs::read(&config).unwrap(), before); +} + /// The two ways a `fix` finishes with something still to answer for. /// /// `--tidy` writes one half of what it found and leaves the other where it was; a staged run writes the bytes the commit is about to carry. @@ -314,7 +337,7 @@ fn diff_is_byte_preserving_and_git_applies_quoted_non_utf8_paths() { String::from_utf8_lossy(&output.stdout) ); - let mut apply = Command::new(git_program()) + let mut apply = common::isolated(git_program()) .current_dir(directory.path()) .args(["apply", "--whitespace=nowarn", "-"]) .stdin(Stdio::piped()) @@ -2364,7 +2387,7 @@ fn a_wide_transaction_completes_under_a_low_file_descriptor_limit() { } /* NOTE: The shell carries the isolation `command` would have given, because the binary is reached through it rather than spawned directly: a user configuration this machine really has would otherwise decide what this test observes. */ - let output = Command::new("/bin/bash") + let output = common::isolated("/bin/bash") .current_dir(directory.path()) .env("PATH", test_path()) .env("XDG_CONFIG_HOME", directory.path().join("no-user-config")) diff --git a/rust/ocomment/tests/common/mod.rs b/rust/ocomment/tests/common/mod.rs new file mode 100644 index 0000000..ce48444 --- /dev/null +++ b/rust/ocomment/tests/common/mod.rs @@ -0,0 +1,11 @@ +use std::{ffi::OsStr, process::Command}; + +pub fn isolated(program: impl AsRef) -> Command { + let mut command = Command::new(program); + for (key, _) in std::env::vars_os() { + if key.to_string_lossy().starts_with("GIT_") { + command.env_remove(key); + } + } + command +} diff --git a/rust/ocomment/tests/deadline.rs b/rust/ocomment/tests/deadline.rs index 0babf1b..eb8f796 100644 --- a/rust/ocomment/tests/deadline.rs +++ b/rust/ocomment/tests/deadline.rs @@ -3,11 +3,9 @@ //! `[policy.allow] tags` and `[policy.allow.expiry]` differ in one thing and it is the thing that needs a repository: whether the tag runs out. //! These tests build one, commit at a date of their choosing, and check that the run reaches the verdict the dates call for — and, just as importantly, that it leaves a comment alone when it cannot read them. -use std::{ - fs, - path::Path, - process::{Command, Output}, -}; +mod common; + +use std::{fs, path::Path, process::Output}; use tempfile::TempDir; fn binary() -> &'static str { @@ -26,7 +24,7 @@ fn no_user_config() -> &'static std::path::Path { } fn git(directory: &Path, arguments: &[&str], date: Option<&str>) { - let mut command = Command::new("git"); + let mut command = common::isolated("git"); command.current_dir(directory).args(arguments); if let Some(date) = date { command @@ -50,7 +48,7 @@ fn run(directory: &Path, arguments: &[&str]) -> Output { arguments.push("--format"); arguments.push("human"); } - Command::new(binary()) + common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory) .args(&arguments) @@ -223,7 +221,7 @@ fn a_proposed_edit_is_judged_against_the_history_of_the_file_it_would_change() { }, }) .to_string(); - let mut child = Command::new(binary()) + let mut child = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(path) .args(["hook", "claude-code"]) diff --git a/rust/ocomment/tests/gate.rs b/rust/ocomment/tests/gate.rs index a681c3e..ee58d59 100644 --- a/rust/ocomment/tests/gate.rs +++ b/rust/ocomment/tests/gate.rs @@ -1,10 +1,8 @@ //! The three things a gate needs besides a verdict: a way to narrow itself to what a branch changed, a refusal to be silently green, and numbers a later step can read. -use std::{ - fs, - path::Path, - process::{Command, Output}, -}; +mod common; + +use std::{fs, path::Path, process::Output}; use tempfile::TempDir; fn binary() -> &'static str { @@ -23,7 +21,7 @@ fn no_user_config() -> &'static std::path::Path { } fn git(directory: &Path, arguments: &[&str]) { - let output = Command::new("git") + let output = common::isolated("git") .current_dir(directory) .args(arguments) .output() @@ -44,7 +42,7 @@ fn run(directory: &Path, arguments: &[&str]) -> Output { arguments.push("--format"); arguments.push("human"); } - Command::new(binary()) + common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory) .args(&arguments) diff --git a/rust/ocomment/tests/hook.rs b/rust/ocomment/tests/hook.rs index 6a0ba7b..cd7f2bb 100644 --- a/rust/ocomment/tests/hook.rs +++ b/rust/ocomment/tests/hook.rs @@ -4,8 +4,10 @@ //! The report is an instruction rather than a listing: the verb on each line is the rule that decided the comment, and a comment that only had to move must not be reported as one to delete. //! The hook is silent unless it has something to say — a hook that spoke on every event would stand between an agent and every file it touched. +mod common; + use serde_json::{Value, json}; -use std::{path::Path, process::Command}; +use std::path::Path; /// The `PATH` a run under test is given. /// @@ -47,7 +49,7 @@ fn project() -> tempfile::TempDir { fn run(directory: &Path, arguments: &[&str], stdin: &str) -> (String, String, i32) { use std::io::Write; - let mut child = Command::new(binary()) + let mut child = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory) .env("PATH", test_path()) diff --git a/rust/ocomment/tests/lsp.rs b/rust/ocomment/tests/lsp.rs index 19beba8..98bc8f8 100644 --- a/rust/ocomment/tests/lsp.rs +++ b/rust/ocomment/tests/lsp.rs @@ -2,11 +2,13 @@ //! //! An editor speaks to this over a pipe and never links the crate, so the cases here do the same: they write framed JSON-RPC in and read framed JSON-RPC out. +mod common; + use serde_json::{Value, json}; use std::{ io::{BufRead, BufReader, Read, Write}, path::Path, - process::{Child, ChildStdin, ChildStdout, Command, Stdio}, + process::{Child, ChildStdin, ChildStdout, Stdio}, }; use tower_lsp::lsp_types::Url; @@ -21,7 +23,7 @@ impl LspClient { /* NOTE: A scratch `XDG_CONFIG_HOME`, because `ocomment` reads a user configuration from it and a suite that let this machine's through would be a suite whose answers depend on whose machine it ran on. */ static EMPTY: std::sync::OnceLock = std::sync::OnceLock::new(); let empty = EMPTY.get_or_init(|| tempfile::tempdir().expect("a temporary directory")); - let mut child = Command::new(env!("CARGO_BIN_EXE_ocomment")) + let mut child = common::isolated(env!("CARGO_BIN_EXE_ocomment")) .arg("lsp") .env("XDG_CONFIG_HOME", empty.path()) .current_dir(directory) diff --git a/rust/ocomment/tests/review.rs b/rust/ocomment/tests/review.rs index 1cadb24..412b7d5 100644 --- a/rust/ocomment/tests/review.rs +++ b/rust/ocomment/tests/review.rs @@ -7,10 +7,9 @@ //! Both are taken from the same file, because the point of the pair is that they say the same thing. //! If one of these ever has to change without the other, that is the finding. -use std::{ - path::Path, - process::{Command, Output}, -}; +mod common; + +use std::{path::Path, process::Output}; use tempfile::TempDir; /// The `PATH` a run under test is given. @@ -41,7 +40,7 @@ fn no_user_config() -> &'static std::path::Path { } fn run(directory: &Path, arguments: &[&str]) -> Output { - Command::new(binary()) + common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory) .env("PATH", test_path()) diff --git a/rust/ocomment/tests/spec_languages.rs b/rust/ocomment/tests/spec_languages.rs index 5e7ec88..fb17125 100644 --- a/rust/ocomment/tests/spec_languages.rs +++ b/rust/ocomment/tests/spec_languages.rs @@ -4,6 +4,8 @@ //! A table like that is only worth publishing while it is true, so every claim it makes is checked here against the code that would have to honour it — //! `ocomment_core::detect_language` for the file names, the binary itself for the dialects and for the listing — and the JSON listing is checked against the table byte for byte, so the two cannot drift apart quietly. +mod common; + use ocomment_core::{Dialect, Language, detect_language}; use serde::Deserialize; use serde_json::{Map, Value, json}; @@ -11,7 +13,7 @@ use std::{ collections::{BTreeMap, BTreeSet}, io::Write, path::Path, - process::{Command, Output, Stdio}, + process::{Output, Stdio}, }; /// The canonical table, as it sits in `spec/`. @@ -114,7 +116,7 @@ fn language(name: &str) -> Language { /// Run the built binary somewhere no configuration file of this machine can reach it, with `input` on its standard input. fn run(arguments: &[&str], input: &[u8]) -> Output { let home = tempfile::tempdir().unwrap(); - let mut child = Command::new(env!("CARGO_BIN_EXE_ocomment")) + let mut child = common::isolated(env!("CARGO_BIN_EXE_ocomment")) .current_dir(home.path()) .env("PATH", test_path()) .env("HOME", home.path()) diff --git a/rust/ocomment/tests/trace.rs b/rust/ocomment/tests/trace.rs index 08b5126..eae08f3 100644 --- a/rust/ocomment/tests/trace.rs +++ b/rust/ocomment/tests/trace.rs @@ -3,7 +3,9 @@ //! The trace is diagnostic: it goes to standard error so that the product on standard output stays exactly what it was, and it is off unless asked for. //! Both of those are properties a change could break without any other test noticing, because every other test runs without the flag. -use std::{path::Path, process::Command}; +mod common; + +use std::path::Path; /// The `PATH` a run under test is given. /// @@ -59,7 +61,7 @@ fn run(directory: &Path, arguments: &[&str]) -> (String, String) { arguments.push("--format"); arguments.push("human"); } - let output = Command::new(binary()) + let output = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory) .env("PATH", test_path()) @@ -187,7 +189,7 @@ fn the_human_trace_names_the_evidence_for_a_language() { #[test] fn selftest_checks_the_embedded_corpus_and_accounts_for_what_it_skips() { let directory = tempfile::tempdir().expect("a temporary directory"); - let output = Command::new(binary()) + let output = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory.path()) .env("PATH", test_path()) @@ -382,7 +384,7 @@ fn a_ledger_fails_when_a_count_rises_and_when_it_falls() { b"// one\n// two\n// three\nfn main() {}\n", ) .expect("the fixture is writable"); - let grew = Command::new(binary()) + let grew = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory.path()) .env("PATH", test_path()) @@ -399,7 +401,7 @@ fn a_ledger_fails_when_a_count_rises_and_when_it_falls() { // NOTE: The half a baseline does not have: finishing the work fails too. std::fs::write(directory.path().join("a.rs"), b"fn main() {}\n") .expect("the fixture is writable"); - let shrank = Command::new(binary()) + let shrank = common::isolated(binary()) .env("XDG_CONFIG_HOME", no_user_config()) .current_dir(directory.path()) .env("PATH", test_path()) diff --git a/rust/xtask/src/main.rs b/rust/xtask/src/main.rs index e4cb095..76d467f 100644 --- a/rust/xtask/src/main.rs +++ b/rust/xtask/src/main.rs @@ -63,6 +63,24 @@ const GREEN: &str = "\x1b[32m"; const YELLOW: &str = "\x1b[33m"; const RESET: &str = "\x1b[0m"; +const GIT_REPOSITORY_ENVIRONMENT: [&str; 15] = [ + "GIT_ALTERNATE_OBJECT_DIRECTORIES", + "GIT_CONFIG", + "GIT_CONFIG_PARAMETERS", + "GIT_CONFIG_COUNT", + "GIT_OBJECT_DIRECTORY", + "GIT_DIR", + "GIT_WORK_TREE", + "GIT_IMPLICIT_WORK_TREE", + "GIT_GRAFT_FILE", + "GIT_INDEX_FILE", + "GIT_NO_REPLACE_OBJECTS", + "GIT_REPLACE_REF_BASE", + "GIT_PREFIX", + "GIT_SHALLOW_FILE", + "GIT_COMMON_DIR", +]; + /// Where the repository is, found from this crate rather than from the directory the caller happened to be in. fn root() -> PathBuf { Path::new(env!("CARGO_MANIFEST_DIR")) @@ -119,6 +137,9 @@ impl Sweep { println!("\n{BOLD}[{:02}] {name}{RESET}", self.number); let mut command = Command::new(program); command.current_dir(&self.root).args(arguments); + for key in GIT_REPOSITORY_ENVIRONMENT { + command.env_remove(key); + } for (key, value) in environment { command.env(key, value); }