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 \" # html # html # html # html {x /* c */} {x } a b a b #not a comment
kept
\n","expect":{"valid":true,"comments":[{"start":6,"end":16,"kind":"line","action":"remove"}],"output_utf8":"kept
\n"}},{"id":"php-close-tag-swallows-newline","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n#!/usr/bin/env php\n\n#!/usr/bin/env php\n not html\"; $b = '?>'; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":" not html\"; $b = '?>'; \n"}},{"id":"php-shebang","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env php\n\r\nx
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":13,"kind":"line","action":"remove"},{"start":15,"end":32,"kind":"block","action":"remove"}],"output_utf8":"\r\nx
\r\n"}},{"id":"php-unterminated-heredoc","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"() {} // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":24,"kind":"line","action":"remove"}]}},{"id":"rust-unicode-loop-label","language":"rust","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"'ä: loop { break 'ä } // remove\n","expect":{"valid":true,"comments":[{"start":24,"end":33,"kind":"line","action":"remove"}]}},{"id":"ocaml-char-literal-across-newline","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = '\n' (* remove *)\nlet b = '\\\n' (* remove *)\n","expect":{"valid":true,"comments":[{"start":12,"end":24,"kind":"block","action":"remove"},{"start":38,"end":50,"kind":"block","action":"remove"}],"output_utf8":"let a = '\n' \nlet b = '\\\n' \n"}},{"id":"ruby-alias-percent-s","language":"ruby","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"alias%s(baz # x) %s(bar)\nputs 1 # remove\n","expect":{"valid":true,"comments":[{"start":32,"end":40,"kind":"line","action":"remove"}],"output_utf8":"alias%s(baz # x) %s(bar)\nputs 1 \n"}},{"id":"bom-shebang-dart","language":"dart","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAK"}},{"id":"swift-nested-block-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nlet a = 1 // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":35,"kind":"block","action":"remove"},{"start":46,"end":55,"kind":"line","action":"remove"}],"output_utf8":"\nlet a = 1 \n"}},{"id":"swift-doc-forms","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not swift\n/** doc */\n/*! bang */\n/**/\n/***/\n// line\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"doc-line","action":"remove"},{"start":18,"end":31,"kind":"line","action":"remove"},{"start":32,"end":42,"kind":"doc-block","action":"remove"},{"start":43,"end":54,"kind":"block","action":"remove"},{"start":55,"end":59,"kind":"block","action":"remove"},{"start":60,"end":65,"kind":"doc-block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\nlet a = 1\n"}},{"id":"swift-interpolation-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"v: \\( 1 /* c */ + 2 )\" // remove\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"block","action":"remove"},{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"let a = \"v: \\( 1 + 2 )\" \n"}},{"id":"swift-multiline-string","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\n// not\n\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = \"\"\"\n// not\n\"\"\"\n\n"}},{"id":"swift-raw-string-hashes","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = ##\"a \"# // not\"##\n// remove\n","expect":{"valid":true,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = ##\"a \"# // not\"##\n\n"}},{"id":"swift-raw-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":30,"end":39,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n\n"}},{"id":"swift-raw-interpolation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"v: \\#( 1 /* c */ ) and \\(1)\"# // remove\n","expect":{"valid":true,"comments":[{"start":19,"end":26,"kind":"block","action":"remove"},{"start":41,"end":50,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"v: \\#( 1 ) and \\(1)\"# \n"}},{"id":"swift-raw-quote-only","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"#\n\n"}},{"id":"swift-string-pound-boundary","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 \n"}},{"id":"swift-extended-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/https://x/# // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = #/https://x/# \n"}},{"id":"swift-extended-regex-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\n x y\n/#\n// remove\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\n x y\n/#\n\n"}},{"id":"swift-bare-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /a\\//;print(1) // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = /a\\//;print(1) \n"}},{"id":"swift-bare-regex-limitation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = / b\\//\nlet c = 1\n","expect":{"valid":true,"comments":[{"start":12,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = / b\\\nlet c = 1\n"}},{"id":"swift-division-not-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 1 / 2 // remove\nlet b = a/a/a // remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"},{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"let a = 1 / 2 \nlet b = a/a/a \n"}},{"id":"swift-regex-comment-wins","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /x//y/\nlet b = 1\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = /x\nlet b = 1\n"}},{"id":"swift-compiler-directive-not-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG\nlet a = 1 // remove\n#endif\n#warning(\"x // y\")\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG\nlet a = 1 \n#endif\n#warning(\"x // y\")\n"}},{"id":"swift-tools-version-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":27,"end":37,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\n\n"}},{"id":"swift-swiftlint-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swiftlint:disable force_cast\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"directive","action":"keep"},{"start":32,"end":42,"kind":"line","action":"remove"}],"output_utf8":"// swiftlint:disable force_cast\n\n"}},{"id":"swift-format-ignore-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-format-ignore-file\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":27,"kind":"directive","action":"keep"},{"start":28,"end":38,"kind":"line","action":"remove"}],"output_utf8":"// swift-format-ignore-file\n\n"}},{"id":"swift-mark-is-not-a-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// MARK: - Section\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"remove"},{"start":19,"end":29,"kind":"line","action":"remove"}],"output_utf8":"\n\n"}},{"id":"swift-unterminated-nested","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open /* inner */\nlet a = 1\n","expect":{"valid":false,"comments":[{"start":0,"end":30,"kind":"block","action":"remove"}],"output_utf8":"/* open /* inner */\nlet a = 1\n"}},{"id":"swift-unterminated-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\nopen\nlet b = 2\n","expect":{"valid":false,"comments":[],"output_utf8":"let a = \"\"\"\nopen\nlet b = 2\n"}},{"id":"swift-unterminated-extended-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\nopen\nlet b = 2 // remove\n","expect":{"valid":false,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\nopen\nlet b = 2 // remove\n"}},{"id":"swift-single-quoted-recovery","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 'x // not'\n// remove\n","expect":{"valid":true,"comments":[{"start":19,"end":28,"kind":"line","action":"remove"}],"output_utf8":"let a = 'x // not'\n\n"}},{"id":"swift-shebang","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env swift\n// remove\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"shebang","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env swift\n\nlet a = 1\n"}},{"id":"swift-crlf","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":62,"end":71,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n\r\n"}},{"id":"swift-columns","language":"swift","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":" \nlet x = 1 \n"}},{"id":"swift-compact","language":"swift","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":"let x = 1\n"}},{"id":"bom-shebang-javascript","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IC8vIHJlbW92ZQo=","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IAo="}},{"id":"csharp-doc-forms","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not csharp\n/** doc */\n/*! bang */\n/**/\n/***/\n/*** three */\n// line\nclass C { }\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"line","action":"remove"},{"start":18,"end":32,"kind":"line","action":"remove"},{"start":33,"end":43,"kind":"doc-block","action":"remove"},{"start":44,"end":55,"kind":"block","action":"remove"},{"start":56,"end":60,"kind":"block","action":"remove"},{"start":61,"end":66,"kind":"block","action":"remove"},{"start":67,"end":80,"kind":"block","action":"remove"},{"start":81,"end":88,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\n\nclass C { }\n"}},{"id":"csharp-non-nested-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"remove"},{"start":47,"end":56,"kind":"line","action":"remove"}],"output_utf8":" still outer */\nvar a = 1; \n"}},{"id":"csharp-verbatim-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"quote \"\" inside // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"quote \"\" inside // no\"; \n"}},{"id":"csharp-verbatim-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"first // no\nsecond */ no\"; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"first // no\nsecond */ no\"; \n"}},{"id":"csharp-verbatim-identifier","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var @class = 1; // remove\n","expect":{"valid":true,"comments":[{"start":16,"end":25,"kind":"line","action":"remove"}],"output_utf8":"var @class = 1; \n"}},{"id":"csharp-interpolated-braces-escape","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{{literal}} // no {x} tail\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{{literal}} // no {x} tail\"; \n"}},{"id":"csharp-interpolated-hole-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x /* hole */} // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":25,"kind":"block","action":"remove"},{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x } // no\"; \n"}},{"id":"csharp-interpolated-hole-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x // hole\n}\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":22,"kind":"line","action":"remove"},{"start":27,"end":36,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x \n}\"; \n"}},{"id":"csharp-interpolated-format-clause","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{x:D4 // no}\"; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{x:D4 // no}\"; \n"}},{"id":"csharp-verbatim-interpolated","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; // remove\n","expect":{"valid":true,"comments":[{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; \n"}},{"id":"csharp-raw-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; \n"}},{"id":"csharp-raw-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\n body // no\n \"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\n body // no\n \"\"\"; \n"}},{"id":"csharp-raw-interpolated-dollar","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $$\"\"\"{not a hole} {{x /* hole */}} // no\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":30,"end":40,"kind":"block","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"var s = $$\"\"\"{not a hole} {{x }} // no\"\"\"; \n"}},{"id":"csharp-utf8-literal","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"bytes // no\"u8; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = \"bytes // no\"u8; \n"}},{"id":"csharp-string-escape-carries-a-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"a\\\nb // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var s = \"a\\\nb // no\"; \n"}},{"id":"csharp-character-literals","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"char a = '/'; char b = '\\''; char c = '\"'; // remove\n","expect":{"valid":true,"comments":[{"start":43,"end":52,"kind":"line","action":"remove"}],"output_utf8":"char a = '/'; char b = '\\''; char c = '\"'; \n"}},{"id":"csharp-preprocessor-if-with-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG // kept\nvar a = 1; // remove\n#endif // tail\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"},{"start":46,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG \nvar a = 1; \n#endif \n"}},{"id":"csharp-region-text-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#region Name // not a comment\n#endregion // a comment\n","expect":{"valid":true,"comments":[{"start":41,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#region Name // not a comment\n#endregion \n"}},{"id":"csharp-pragma-text","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#pragma warning disable 1591 // a comment\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":29,"end":41,"kind":"line","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"#pragma warning disable 1591 \nvar a = 1; \n"}},{"id":"csharp-line-directive-string","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#line 1 \"a//b.cs\" // tail\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"},{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"#line 1 \"a//b.cs\" \nvar a = 1; \n"}},{"id":"csharp-error-message-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#error boom // no\n","expect":{"valid":true,"comments":[],"output_utf8":"#error boom // no\n"}},{"id":"csharp-directive-block-comment-is-not-one","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; \n"}},{"id":"csharp-hash-after-code-is-not-a-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var a = 1; #if X // no\n#endif\n","expect":{"valid":true,"comments":[],"output_utf8":"var a = 1; #if X // no\n#endif\n"}},{"id":"csharp-unicode-line-terminator","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"dmFyIGEgPSAxOyAvLyBj4oCodmFyIGIgPSAyOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"}],"output_base64":"dmFyIGEgPSAxOyDigKh2YXIgYiA9IDI7IAo="}},{"id":"csharp-auto-generated-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//{x // c\n}
\n\n","expect":{"valid":true,"comments":[{"start":6,"end":10,"kind":"line","action":"remove"},{"start":17,"end":30,"kind":"html-comment","action":"keep"}],"output_utf8":"{x \n}
\n\n"}},{"id":"markdown-fences-and-inline-code","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"```nope\n// not a comment\n```\n`// not either`\n /* nor this */\n","expect":{"valid":true,"comments":[]}},{"id":"perl-ambiguous-slash-after-paren","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"sub f { 1 }\nf() /a#b/;\nmy $x = (2) / 2; # division\n","expect":{"valid":false,"comments":[]}},{"id":"perl-compound-opaque-sections","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"my @items = (1);\nprint $#items, $^X; # variables\nmy $q = \"escaped \\\" # opaque\"; # quote\n$x =~ s/foo#one/bar#two/g; # substitution\nprint << \"ONE\", <<~'TWO';\n# first body\nONE\n # second body\n TWO\n=pod\n# pod body\n=cutlery\n# still pod\n=cut\nformat STDOUT =\n@<<<<<<<<\n# picture body\n.\n# after format\n__DATA__\n# data body\n","expect":{"valid":true,"comments":[{"start":37,"end":48,"kind":"line","action":"remove"},{"start":80,"end":87,"kind":"line","action":"remove"},{"start":115,"end":129,"kind":"line","action":"remove"},{"start":281,"end":295,"kind":"line","action":"remove"}]}},{"id":"scss-interpolation-in-string-and-url","language":"css","dialect":"scss","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a { x: \"#{1 /* string */}\"; y: url( \"#{2 /* url */}\" ); z: url(foo\\)bar//opaque); // outer\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":25,"kind":"block","action":"remove"},{"start":42,"end":51,"kind":"block","action":"remove"},{"start":83,"end":91,"kind":"line","action":"remove"}]}},{"id":"sass-silent-comment-indented-body","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a\n // parent\n color: red\n width: 1px\n color: blue\n// root\n nested: yes\n.b\n color: green\n","expect":{"valid":true,"comments":[{"start":5,"end":46,"kind":"line","action":"remove"},{"start":61,"end":82,"kind":"line","action":"remove"}]}},{"id":"vue-exact-attributes-directives-and-nested-v-pre","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"x
\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\nx
\n"}},{"id":"profile-longest-token-wins-over-declaration-order","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"//// module\n/// item\n// remark\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"keep"},{"start":12,"end":20,"kind":"doc-line","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}]}},{"id":"profile-prefix-delimiters-are-not-ambiguous","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"///doc\n//remark\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"keep"},{"start":7,"end":15,"kind":"line","action":"remove"}]}},{"id":"profile-a-string-still-hides-a-comment-token","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"pub const s = \"// not a comment\"\n// a comment\n","expect":{"valid":true,"comments":[{"start":33,"end":45,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-dashes-open-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- a remark\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-an-operator-is-not-a-comment","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a --> b\nc <-- d\n","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"}],"output_utf8":"a --> b\nc <\n"}},{"id":"profile-haskell-a-longer-run-of-dashes-is-still-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"---x is a comment\ny = 2\n","expect":{"valid":true,"comments":[{"start":0,"end":17,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-longer-run-before-a-symbol-is-an-operator","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a ----> b\n","expect":{"valid":true,"comments":[],"output_utf8":"a ----> b\n"}},{"id":"profile-haskell-haddock-continues-with-the-plain-opener","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | The first line is marked.\n-- The rest is not.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"doc-line","action":"keep"},{"start":31,"end":52,"kind":"doc-line","action":"keep"}]}},{"id":"profile-haskell-a-blank-line-ends-the-continuation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\n\n-- an unrelated remark\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":21,"end":43,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-remark-below-code-is-not-documentation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\nadd = 1\n-- an unrelated remark\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":28,"end":50,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-nesting-counts-the-pairing","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n","expect":{"valid":true,"comments":[{"start":0,"end":58,"kind":"doc-block","action":"keep"}],"output_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n"}},{"id":"profile-haskell-a-string-hides-both-comment-forms","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"s = \"-- not a comment, {- nor this -}\"\n-- a comment\n","expect":{"valid":true,"comments":[{"start":39,"end":51,"kind":"line","action":"remove"}]}},{"id":"profile-style-reads-the-profiles-own-marker","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"space_after_marker":true}},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- |Documentation written against its marker.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":45,"kind":"doc-line","action":"rewrite"}],"output_utf8":"-- | Documentation written against its marker.\nadd = 1\n"}},{"id":"wrap-joins-a-break-nobody-meant","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken\n/// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":84,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-breaks-after-every-sentence","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second on the same line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence.\n/// And a second on the same line.\nfn a() {}\n"}},{"id":"wrap-keeps-a-break-after-a-clause","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":49,"kind":"doc-line","action":"keep"},{"start":50,"end":85,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n"}},{"id":"wrap-unwrap-joins-without-breaking-sentences","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"unwrap"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was\n/// broken to fit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":78,"kind":"doc-line","action":"keep"},{"start":79,"end":97,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was broken to fit.\nfn a() {}\n"}},{"id":"wrap-leaves-a-fenced-code-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps\n/// here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":46,"kind":"doc-line","action":"keep"},{"start":47,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":68,"kind":"doc-line","action":"keep"},{"start":69,"end":83,"kind":"doc-line","action":"keep"},{"start":84,"end":109,"kind":"doc-line","action":"keep"},{"start":110,"end":117,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n"}},{"id":"wrap-leaves-a-section-heading","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":38,"kind":"doc-line","action":"keep"},{"start":39,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n"}},{"id":"wrap-leaves-a-link-reference-definition","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":70,"kind":"doc-line","action":"keep"},{"start":71,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n"}},{"id":"wrap-reaches-a-list-item-and-keeps-its-indentation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps\n/// onto the next line. And a second sentence.\n/// - another\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":105,"kind":"doc-line","action":"keep"},{"start":106,"end":119,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps onto the next line.\n/// And a second sentence.\n/// - another\nfn a() {}\n"}},{"id":"wrap-leaves-a-table","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":39,"kind":"doc-line","action":"keep"},{"start":40,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":67,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n"}},{"id":"wrap-does-not-break-inside-a-host-name","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details. Version 1.5 is fine.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":93,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details.\n/// Version 1.5 is fine.\nfn a() {}\n"}},{"id":"wrap-does-not-break-after-an-abbreviation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence. J. Smith neither.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence.\n/// J. Smith neither.\nfn a() {}\n"}},{"id":"wrap-breaks-a-cjk-sentence-without-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。これは二文目。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。\n/// これは二文目。\nfn a() {}\n"}},{"id":"wrap-joins-cjk-without-inserting-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで\n/// 折り返されている。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":89,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで折り返されている。\nfn a() {}\n"}},{"id":"wrap-reaches-a-line-comment-run-too","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken\n// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"line","action":"keep"},{"start":54,"end":80,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-leaves-a-run-whose-lines-open-differently","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n"}},{"id":"wrap-reaches-a-block-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":73,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line. */\nfn a() {}\n"}},{"id":"wrap-leaves-the-first-two-lines-alone","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"line","action":"keep"},{"start":27,"end":52,"kind":"line","action":"keep"}],"output_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n"}},{"id":"wrap-keeps-crlf-endings","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken\r\n/// to keep the line short.\r\nfn a() {}\r\n","expect":{"valid":true,"comments":[{"start":28,"end":58,"kind":"doc-line","action":"keep"},{"start":60,"end":87,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken to keep the line short.\r\nfn a() {}\r\n"}},{"id":"wrap-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n/// onto a second line.\nfn a() {}\n// a remark\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":78,"kind":"doc-line","action":"keep"},{"start":89,"end":100,"kind":"line","action":"remove"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps onto a second line.\nfn a() {}\n\nfn b() {}\n"}},{"id":"wrap-leaves-a-comment-beside-code","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":37,"end":61,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n"}},{"id":"wrap-reaches-the-first-line-where-no-preamble-is-read","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"//! Module documentation that was broken\n//! to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"doc-line","action":"keep"},{"start":41,"end":68,"kind":"doc-line","action":"keep"}],"output_utf8":"//! Module documentation that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-keeps-a-block-closer-on-its-own-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line.\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line.\n */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-that-fits-on-one-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":58,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n"}},{"id":"wrap-aligns-an-ocaml-block-under-its-text","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines\n are aligned under the text. And a second sentence. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":118,"kind":"block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines are aligned under the text.\n And a second sentence. *)\nlet a = 3\n"}},{"id":"wrap-reaches-an-ocaml-documentation-block","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps\n onto a second line. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":80,"kind":"doc-block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps onto a second line. *)\nlet a = 3\n"}},{"id":"wrap-keeps-a-blank-line-inside-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps\n * onto a line.\n *\n * A second paragraph. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps onto a line.\n *\n * A second paragraph. */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-whose-interior-is-a-code-example","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":100,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n"}},{"id":"wrap-leaves-an-example-indented-under-an-item","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps\n/// onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":50,"kind":"doc-line","action":"keep"},{"start":51,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":73,"kind":"doc-line","action":"keep"},{"start":74,"end":92,"kind":"doc-line","action":"keep"},{"start":93,"end":96,"kind":"doc-line","action":"keep"},{"start":97,"end":107,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n"}},{"id":"wrap-keeps-a-nested-list-nested","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps\n/// onto a line\n/// - inner item that wraps\n/// onto a line\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":71,"kind":"doc-line","action":"keep"},{"start":72,"end":101,"kind":"doc-line","action":"keep"},{"start":102,"end":121,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps onto a line\n/// - inner item that wraps onto a line\nfn a() {}\n"}},{"id":"wrap-splits-an-item-into-sentences-under-its-marker","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence. And a second.\n/// 2. Another.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence.\n/// And a second.\n/// 2. Another.\nfn a() {}\n"}},{"id":"wrap-splits-a-run-at-a-line-a-style-rule-cannot-reach","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps\n/// onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps\n/// onto a line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":52,"kind":"doc-line","action":"keep"},{"start":53,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":104,"kind":"directive","action":"keep"},{"start":105,"end":131,"kind":"doc-line","action":"keep"},{"start":132,"end":148,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps onto a line.\nfn a() {}\n"}},{"id":"wrap-joins-a-sentence-that-opens-with-an-intra-doc-link","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs\n/// to, because that run is longer than the limit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":90,"kind":"doc-line","action":"keep"},{"start":91,"end":141,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs to, because that run is longer than the limit.\nfn a() {}\n"}},{"id":"wrap-reaches-a-markdown-paragraph","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"A paragraph that wraps\nacross two lines. And a second sentence.\n","expect":{"valid":true,"comments":[],"output_utf8":"A paragraph that wraps across two lines.\nAnd a second sentence.\n"}},{"id":"wrap-leaves-a-markdown-fence","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n```\ncode that wraps\nshould not join.\n```\n","expect":{"valid":true,"comments":[],"output_utf8":"Prose that wraps across lines.\n\n```\ncode that wraps\nshould not join.\n```\n"}},{"id":"wrap-leaves-markdown-front-matter","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-heading-and-table","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-html-comment-to-the-comment-path","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n\n","expect":{"valid":true,"comments":[{"start":32,"end":80,"kind":"html-comment","action":"keep"}],"output_utf8":"Prose that wraps across lines.\n\n\n"}},{"id":"wrap-reaches-a-markdown-list-item","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- an item that wraps\n onto the next line. And a second sentence.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- an item that wraps onto the next line.\n And a second sentence.\n- another\n"}},{"id":"wrap-keeps-an-item-open-across-a-clause-break","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps\n onto two more lines.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps onto two more lines.\n- another\n"}},{"id":"wrap-writes-a-continued-item-under-its-marker","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n a second sentence. And a third.\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n a second sentence.\n And a third.\n"}},{"id":"wrap-keeps-the-indentation-the-source-wrote","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// A sentence that was broken\n /// to keep the line short.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"},{"start":48,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// A sentence that was broken to keep the line short.\n fn a() {}\n}\n"}},{"id":"wrap-indents-the-lines-a-split-opens","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// One sentence. Another one.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// One sentence.\n /// Another one.\n fn a() {}\n}\n"}},{"id":"wrap-refuses-a-run-whose-lines-sit-at-different-columns","language":"yaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n","expect":{"valid":true,"comments":[{"start":6,"end":19,"kind":"line","action":"keep"},{"start":24,"end":49,"kind":"line","action":"keep"},{"start":54,"end":75,"kind":"line","action":"keep"}],"output_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n"}},{"id":"declarative-profile-reaches-the-style-axis-too","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"wrap":"sentence"},"layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":"//","kind":"line"}],"block_comments":[],"strings":[],"protected_patterns":[]},"source_utf8":"call()\n// A remark. Another one.\ncall()\n","expect":{"valid":true,"comments":[{"start":7,"end":32,"kind":"line","action":"keep"}],"output_utf8":"call()\n// A remark.\n// Another one.\ncall()\n"}},{"id":"a-scan-records-the-run-it-rewrote","language":"rust","operation":"scan","options":{"policy":"none","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\n// A remark. Another one.\nfn also() {}\n","expect":{"valid":true,"comments":[{"start":13,"end":38,"kind":"line","action":"keep"}]}},{"id":"wrap-leaves-a-labelled-divider-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n","expect":{"valid":true,"comments":[{"start":4,"end":58,"kind":"line","action":"keep"},{"start":59,"end":117,"kind":"line","action":"keep"}],"output_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n"}},{"id":"wrap-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":"//{x /* c */}
\n\n","expect":{"valid":true,"comments":[{"start":19,"end":24,"kind":"line","action":"remove"},{"start":55,"end":62,"kind":"line","action":"remove"},{"start":78,"end":85,"kind":"block","action":"remove"},{"start":91,"end":104,"kind":"html-comment","action":"keep"}],"output_utf8":"\n\n{x }
\n\n"}},{"id":"markdown-builtin-safe","language":"markdown","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"text\n\nmore\n```rust\n// c\n```\n`// inline`\n","expect":{"valid":true,"comments":[{"start":5,"end":18,"kind":"html-comment","action":"keep"},{"start":32,"end":36,"kind":"line","action":"remove"}],"output_utf8":"text\n\nmore\n```rust\n\n```\n`// inline`\n"}},{"id":"perl-builtin-safe","language":"perl","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"=head1 NAME\n# not a comment\n=cut\nmy $x = 'a#b';\nif ($x =~ /a#b/) { print \"yes\\n\" }\nmy $y = $x / 2; # division\n","expect":{"valid":true,"comments":[{"start":99,"end":109,"kind":"line","action":"remove"}],"output_utf8":"=head1 NAME\n# not a comment\n=cut\nmy $x = 'a#b';\nif ($x =~ /a#b/) { print \"yes\\n\" }\nmy $y = $x / 2; \n"}},{"id":"rust-nested-raw","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"r#\"// opaque\"# /* outer /* inner */ end */\\n// rustfmt::skip\\n","expect":{"valid":true,"comments":[{"start":15,"end":42,"kind":"block","action":"remove"},{"start":44,"end":62,"kind":"directive","action":"keep"}],"output_utf8":"r#\"// opaque\"# \\n// rustfmt::skip\\n"}},{"id":"rust-raw-c-string","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"cr#\"inner \" // opaque\"#; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"cr#\"inner \" // opaque\"#; \n"}},{"id":"rust-multiline-string","language":"rust","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const A: &str = \"a\n// opaque\nb\"; // remove\n","expect":{"valid":true,"comments":[{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"const A: &str = \"a\n// opaque\nb\"; \n"}},{"id":"ocaml-nested-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{tag| (* opaque *) |tag} (* outer \"*)\" (* inner *) *)","expect":{"valid":true,"comments":[{"start":25,"end":53,"kind":"block","action":"remove"}],"output_utf8":"{tag| (* opaque *) |tag} "}},{"id":"ocaml-comment-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"(* outer {tag| *) opaque |tag} end *)","expect":{"valid":true,"comments":[{"start":0,"end":37,"kind":"block","action":"remove"}],"output_utf8":""}},{"id":"ocaml-long-quoted-id","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|(* opaque *)|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} (* remove *)","expect":{"valid":true,"comments":[{"start":177,"end":189,"kind":"block","action":"remove"}],"output_utf8":"{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa|(* opaque *)|aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa} "}},{"id":"invalid-ocaml-quoted","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"{tag| unterminated (* opaque *)","expect":{"valid":false,"comments":[],"output_utf8":"{tag| unterminated (* opaque *)"}},{"id":"c-line-splice","language":"c","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x; /\\\n/ comment\\\ncontinued\nint y;","expect":{"valid":true,"comments":[{"start":7,"end":30,"kind":"line","action":"remove"}],"output_utf8":"int x; \n\n\nint y;"}},{"id":"cpp-raw","language":"cpp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"R\"tag(/* opaque */ // opaque)tag\" // remove","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"R\"tag(/* opaque */ // opaque)tag\" "}},{"id":"go-directives","language":"go","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//go:build linux\n// +build linux\n//line generated.go:1\n// remove\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"load-bearing","action":"keep"},{"start":17,"end":32,"kind":"load-bearing","action":"keep"},{"start":33,"end":54,"kind":"directive","action":"keep"},{"start":55,"end":64,"kind":"line","action":"remove"}],"output_utf8":"//go:build linux\n// +build linux\n//line generated.go:1\n\n"}},{"id":"java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x; \\u002f\\u002f comment\\u000aint y;","expect":{"valid":true,"comments":[{"start":7,"end":27,"kind":"line","action":"remove"}],"output_utf8":"int x; \\u000aint y;"}},{"id":"java-unicode-surrogates","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"String s = \"\\uD83D\\uDE00 // opaque\"; // remove","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"String s = \"\\uD83D\\uDE00 // opaque\"; "}},{"id":"invalid-java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"int x = 1; \\u00G0 // known","expect":{"valid":false,"comments":[{"start":18,"end":26,"kind":"line","action":"remove"}],"output_utf8":"int x = 1; \\u00G0 // known"}},{"id":"forced-invalid-java-unicode","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines","force_invalid":true},"source_utf8":"int x = 1; \\u00G0 // known","expect":{"valid":false,"comments":[{"start":18,"end":26,"kind":"line","action":"remove"}],"output_utf8":"int x = 1; \\u00G0 "}},{"id":"java-text-block-escape","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"String s = \"\"\"\n\\\"\"\" // opaque\nend\n\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"String s = \"\"\"\n\\\"\"\" // opaque\nend\n\"\"\"; \n"}},{"id":"java-inner-doc-marker","language":"java","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// javadoc\n//! plain\n/** javadoc */\n/*! plain */\nclass A {}\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"remove"},{"start":12,"end":21,"kind":"line","action":"remove"},{"start":22,"end":36,"kind":"doc-block","action":"remove"},{"start":37,"end":49,"kind":"block","action":"remove"}],"output_utf8":"\n\n\n\nclass A {}\n"}},{"id":"javascript-goals","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env node\nconst r = /\\/\\/* opaque/;\nconst t = `literal // opaque ${1 /* remove */}`;\n// remove\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":79,"end":91,"kind":"block","action":"remove"},{"start":95,"end":104,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env node\nconst r = /\\/\\/* opaque/;\nconst t = `literal // opaque ${1 }`;\n\n"}},{"id":"javascript-control-regex","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"if (ready) /https?:\\/\\/example\\.test/.test(value); // remove","expect":{"valid":true,"comments":[{"start":51,"end":60,"kind":"line","action":"remove"}],"output_utf8":"if (ready) /https?:\\/\\/example\\.test/.test(value); "}},{"id":"javascript-brace-goals","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const ratio = {} / 2; // remove\nif (ready) {} /[/*]/.test(value); // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"},{"start":66,"end":75,"kind":"line","action":"remove"}],"output_utf8":"const ratio = {} / 2; \nif (ready) {} /[/*]/.test(value); \n"}},{"id":"javascript-html-like-comments","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"const x = 1; remove\nconst text = '","expect":{"valid":true,"comments":[{"start":2,"end":20,"kind":"html-comment","action":"remove"},{"start":36,"end":41,"kind":"block","action":"remove"}],"output_utf8":"ab"}},{"id":"non-utf8-bytes","language":"c","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"/y8qIHJlbW92ZSAqL4ANCg==","expect":{"valid":true,"comments":[{"start":1,"end":13,"kind":"block","action":"remove"}],"output_base64":"/yCADQo="}},{"id":"compact-layout","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"left/* remove */right\n","expect":{"valid":true,"comments":[{"start":4,"end":16,"kind":"block","action":"remove"}],"output_utf8":"left right\n"}},{"id":"compact-whole-line-run","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"fn main() {}\n// one\n// two\nlet x = 1;\n","expect":{"valid":true,"comments":[{"start":13,"end":19,"kind":"line","action":"remove"},{"start":20,"end":26,"kind":"line","action":"remove"}],"output_utf8":"fn main() {}\nlet x = 1;\n"}},{"id":"compact-indented-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"fn main() {\n // note\n let x = 1;\n}\n","expect":{"valid":true,"comments":[{"start":16,"end":23,"kind":"line","action":"remove"}],"output_utf8":"fn main() {\n let x = 1;\n}\n"}},{"id":"compact-crlf-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1;\r\n// note\r\nlet y = 2;\r\n","expect":{"valid":true,"comments":[{"start":12,"end":19,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;\r\nlet y = 2;\r\n"}},{"id":"compact-trailing-whitespace","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1; \t // note\nlet y = 2;\t/* two */\t\nlet z = 3;\n","expect":{"valid":true,"comments":[{"start":13,"end":20,"kind":"line","action":"remove"},{"start":32,"end":41,"kind":"block","action":"remove"}],"output_utf8":"let x = 1;\nlet y = 2;\nlet z = 3;\n"}},{"id":"compact-no-final-newline","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1; // note","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;"}},{"id":"compact-last-line-only-comment","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"let x = 1;\n// note","expect":{"valid":true,"comments":[{"start":11,"end":18,"kind":"line","action":"remove"}],"output_utf8":"let x = 1;\n"}},{"id":"compact-block-shares-lines-with-code","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int a = 1; /* one\ntwo\nthree */ int b = 2;\n","expect":{"valid":true,"comments":[{"start":11,"end":30,"kind":"block","action":"remove"}],"output_utf8":"int a = 1;\n int b = 2;\n"}},{"id":"compact-block-alone-on-its-lines","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int a = 1;\n/* one\ntwo */\nint b = 2;\n","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"block","action":"remove"}],"output_utf8":"int a = 1;\nint b = 2;\n"}},{"id":"compact-block-at-end-without-newline","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"int x = 1; /* one\ntwo */","expect":{"valid":true,"comments":[{"start":11,"end":24,"kind":"block","action":"remove"}],"output_utf8":"int x = 1;\n"}},{"id":"compact-two-comments-on-one-line","language":"c","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"a/* one */ /* two */\n","expect":{"valid":true,"comments":[{"start":1,"end":10,"kind":"block","action":"remove"},{"start":11,"end":20,"kind":"block","action":"remove"}],"output_utf8":"a\n"}},{"id":"compact-html-comment","language":"html","operation":"transform","options":{"policy":"all","layout":"compact"},"source_utf8":"a
\n\nb
\n","expect":{"valid":true,"comments":[{"start":9,"end":22,"kind":"html-comment","action":"remove"},{"start":32,"end":48,"kind":"html-comment","action":"remove"}],"output_utf8":"a
\nb
\n"}},{"id":"compact-javascript-line-separator","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_base64":"bGV0IGEgPSAxO+KAqC8vIG5vdGXigKhsZXQgYiA9IDI7Cg==","expect":{"valid":true,"comments":[{"start":13,"end":20,"kind":"line","action":"remove"}],"output_base64":"bGV0IGEgPSAxO+KAqGxldCBiID0gMjsK"}},{"id":"compact-kept-comment-holds-its-line","language":"rust","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// rustfmt::skip\n// note\nfn main() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":16,"kind":"directive","action":"keep"},{"start":17,"end":24,"kind":"line","action":"remove"}],"output_utf8":"// rustfmt::skip\nfn main() {}\n"}},{"id":"invalid-cpp-raw","language":"cpp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"R\"tag(unterminated /* opaque */","expect":{"valid":false,"comments":[],"output_utf8":"R\"tag(unterminated /* opaque */"}},{"id":"invalid-shell-quote","language":"shell","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"echo 'unterminated","expect":{"valid":false,"comments":[],"output_utf8":"echo 'unterminated"}},{"id":"invalid-shell-heredoc","language":"shell","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"cat <#not a comment
\n#not a comment\n\n","expect":{"valid":true,"comments":[{"start":10,"end":19,"kind":"line","action":"remove"}],"output_utf8":"= $name \n?>\n"}},{"id":"php-xml-decl-not-open-tag","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n\nkept
\n","expect":{"valid":true,"comments":[{"start":6,"end":16,"kind":"line","action":"remove"}],"output_utf8":"kept
\n"}},{"id":"php-close-tag-swallows-newline","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"\n#!/usr/bin/env php\n\n#!/usr/bin/env php\n not html\"; $b = '?>'; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":" not html\"; $b = '?>'; \n"}},{"id":"php-shebang","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env php\n\r\nx
\r\n","expect":{"valid":true,"comments":[{"start":6,"end":13,"kind":"line","action":"remove"},{"start":15,"end":32,"kind":"block","action":"remove"}],"output_utf8":"\r\nx
\r\n"}},{"id":"php-unterminated-heredoc","language":"php","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"() {} // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":24,"kind":"line","action":"remove"}]}},{"id":"rust-unicode-loop-label","language":"rust","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"'ä: loop { break 'ä } // remove\n","expect":{"valid":true,"comments":[{"start":24,"end":33,"kind":"line","action":"remove"}]}},{"id":"ocaml-char-literal-across-newline","language":"ocaml","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = '\n' (* remove *)\nlet b = '\\\n' (* remove *)\n","expect":{"valid":true,"comments":[{"start":12,"end":24,"kind":"block","action":"remove"},{"start":38,"end":50,"kind":"block","action":"remove"}],"output_utf8":"let a = '\n' \nlet b = '\\\n' \n"}},{"id":"ruby-alias-percent-s","language":"ruby","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"alias%s(baz # x) %s(bar)\nputs 1 # remove\n","expect":{"valid":true,"comments":[{"start":32,"end":40,"kind":"line","action":"remove"}],"output_utf8":"alias%s(baz # x) %s(bar)\nputs 1 \n"}},{"id":"bom-shebang-dart","language":"dart","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgZGFydAp2b2lkIG1haW4oKSB7fSAK"}},{"id":"swift-nested-block-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nlet a = 1 // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":35,"kind":"block","action":"remove"},{"start":46,"end":55,"kind":"line","action":"remove"}],"output_utf8":"\nlet a = 1 \n"}},{"id":"swift-doc-forms","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not swift\n/** doc */\n/*! bang */\n/**/\n/***/\n// line\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"doc-line","action":"remove"},{"start":18,"end":31,"kind":"line","action":"remove"},{"start":32,"end":42,"kind":"doc-block","action":"remove"},{"start":43,"end":54,"kind":"block","action":"remove"},{"start":55,"end":59,"kind":"block","action":"remove"},{"start":60,"end":65,"kind":"doc-block","action":"remove"},{"start":66,"end":73,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\nlet a = 1\n"}},{"id":"swift-interpolation-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"v: \\( 1 /* c */ + 2 )\" // remove\n","expect":{"valid":true,"comments":[{"start":17,"end":24,"kind":"block","action":"remove"},{"start":33,"end":42,"kind":"line","action":"remove"}],"output_utf8":"let a = \"v: \\( 1 + 2 )\" \n"}},{"id":"swift-multiline-string","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\n// not\n\"\"\"\n// remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = \"\"\"\n// not\n\"\"\"\n\n"}},{"id":"swift-raw-string-hashes","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = ##\"a \"# // not\"##\n// remove\n","expect":{"valid":true,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = ##\"a \"# // not\"##\n\n"}},{"id":"swift-raw-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":30,"end":39,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"\n// not \\(1)\n\"\"\"#\n\n"}},{"id":"swift-raw-interpolation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"v: \\#( 1 /* c */ ) and \\(1)\"# // remove\n","expect":{"valid":true,"comments":[{"start":19,"end":26,"kind":"block","action":"remove"},{"start":41,"end":50,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"v: \\#( 1 ) and \\(1)\"# \n"}},{"id":"swift-raw-quote-only","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #\"\"\"#\n// remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"}],"output_utf8":"let a = #\"\"\"#\n\n"}},{"id":"swift-string-pound-boundary","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"let a = \"x\"#/y // z/#\nlet b = 1 \n"}},{"id":"swift-extended-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/https://x/# // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = #/https://x/# \n"}},{"id":"swift-extended-regex-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\n x y\n/#\n// remove\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\n x y\n/#\n\n"}},{"id":"swift-bare-regex-literal","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /a\\//;print(1) // remove\n","expect":{"valid":true,"comments":[{"start":23,"end":32,"kind":"line","action":"remove"}],"output_utf8":"let a = /a\\//;print(1) \n"}},{"id":"swift-bare-regex-limitation","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = / b\\//\nlet c = 1\n","expect":{"valid":true,"comments":[{"start":12,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = / b\\\nlet c = 1\n"}},{"id":"swift-division-not-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 1 / 2 // remove\nlet b = a/a/a // remove\n","expect":{"valid":true,"comments":[{"start":14,"end":23,"kind":"line","action":"remove"},{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"let a = 1 / 2 \nlet b = a/a/a \n"}},{"id":"swift-regex-comment-wins","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = /x//y/\nlet b = 1\n","expect":{"valid":true,"comments":[{"start":10,"end":14,"kind":"line","action":"remove"}],"output_utf8":"let a = /x\nlet b = 1\n"}},{"id":"swift-compiler-directive-not-comment","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG\nlet a = 1 // remove\n#endif\n#warning(\"x // y\")\n","expect":{"valid":true,"comments":[{"start":20,"end":29,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG\nlet a = 1 \n#endif\n#warning(\"x // y\")\n"}},{"id":"swift-tools-version-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-tools-version:5.9\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"load-bearing","action":"keep"},{"start":27,"end":37,"kind":"line","action":"remove"}],"output_utf8":"// swift-tools-version:5.9\n\n"}},{"id":"swift-swiftlint-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swiftlint:disable force_cast\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":31,"kind":"directive","action":"keep"},{"start":32,"end":42,"kind":"line","action":"remove"}],"output_utf8":"// swiftlint:disable force_cast\n\n"}},{"id":"swift-format-ignore-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// swift-format-ignore-file\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":27,"kind":"directive","action":"keep"},{"start":28,"end":38,"kind":"line","action":"remove"}],"output_utf8":"// swift-format-ignore-file\n\n"}},{"id":"swift-mark-is-not-a-directive","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"// MARK: - Section\n// control\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"remove"},{"start":19,"end":29,"kind":"line","action":"remove"}],"output_utf8":"\n\n"}},{"id":"swift-unterminated-nested","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* open /* inner */\nlet a = 1\n","expect":{"valid":false,"comments":[{"start":0,"end":30,"kind":"block","action":"remove"}],"output_utf8":"/* open /* inner */\nlet a = 1\n"}},{"id":"swift-unterminated-multiline","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = \"\"\"\nopen\nlet b = 2\n","expect":{"valid":false,"comments":[],"output_utf8":"let a = \"\"\"\nopen\nlet b = 2\n"}},{"id":"swift-unterminated-extended-regex","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = #/\nopen\nlet b = 2 // remove\n","expect":{"valid":false,"comments":[{"start":26,"end":35,"kind":"line","action":"remove"}],"output_utf8":"let a = #/\nopen\nlet b = 2 // remove\n"}},{"id":"swift-single-quoted-recovery","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"let a = 'x // not'\n// remove\n","expect":{"valid":true,"comments":[{"start":19,"end":28,"kind":"line","action":"remove"}],"output_utf8":"let a = 'x // not'\n\n"}},{"id":"swift-shebang","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#!/usr/bin/env swift\n// remove\nlet a = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"shebang","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}],"output_utf8":"#!/usr/bin/env swift\n\nlet a = 1\n"}},{"id":"swift-crlf","language":"swift","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* block\r\nstill */\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n// remove\r\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"block","action":"remove"},{"start":62,"end":71,"kind":"line","action":"remove"}],"output_utf8":"\r\n\r\nlet a = \"\"\"\r\nx\r\n\"\"\"\r\nlet b = #/\r\n x\r\n/#\r\n\r\n"}},{"id":"swift-columns","language":"swift","operation":"transform","options":{"policy":"standard","layout":"columns"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":" \nlet x = 1 \n"}},{"id":"swift-compact","language":"swift","operation":"transform","options":{"policy":"standard","layout":"compact"},"source_utf8":"// alone\nlet x = 1 // trailing\n","expect":{"valid":true,"comments":[{"start":0,"end":8,"kind":"line","action":"remove"},{"start":19,"end":30,"kind":"line","action":"remove"}],"output_utf8":"let x = 1\n"}},{"id":"bom-shebang-javascript","language":"javascript","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IC8vIHJlbW92ZQo=","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_base64":"77u/IyEvdXNyL2Jpbi9lbnYgbm9kZQpsZXQgeCA9IDE7IAo="}},{"id":"csharp-doc-forms","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/// doc\n//// four\n//! not csharp\n/** doc */\n/*! bang */\n/**/\n/***/\n/*** three */\n// line\nclass C { }\n","expect":{"valid":true,"comments":[{"start":0,"end":7,"kind":"doc-line","action":"remove"},{"start":8,"end":17,"kind":"line","action":"remove"},{"start":18,"end":32,"kind":"line","action":"remove"},{"start":33,"end":43,"kind":"doc-block","action":"remove"},{"start":44,"end":55,"kind":"block","action":"remove"},{"start":56,"end":60,"kind":"block","action":"remove"},{"start":61,"end":66,"kind":"block","action":"remove"},{"start":67,"end":80,"kind":"block","action":"remove"},{"start":81,"end":88,"kind":"line","action":"remove"}],"output_utf8":"\n\n\n\n\n\n\n\n\nclass C { }\n"}},{"id":"csharp-non-nested-block","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"/* outer /* inner */ still outer */\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":0,"end":20,"kind":"block","action":"remove"},{"start":47,"end":56,"kind":"line","action":"remove"}],"output_utf8":" still outer */\nvar a = 1; \n"}},{"id":"csharp-verbatim-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"quote \"\" inside // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":34,"end":43,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"quote \"\" inside // no\"; \n"}},{"id":"csharp-verbatim-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = @\"first // no\nsecond */ no\"; // remove\n","expect":{"valid":true,"comments":[{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"var s = @\"first // no\nsecond */ no\"; \n"}},{"id":"csharp-verbatim-identifier","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var @class = 1; // remove\n","expect":{"valid":true,"comments":[{"start":16,"end":25,"kind":"line","action":"remove"}],"output_utf8":"var @class = 1; \n"}},{"id":"csharp-interpolated-braces-escape","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{{literal}} // no {x} tail\"; // remove\n","expect":{"valid":true,"comments":[{"start":39,"end":48,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{{literal}} // no {x} tail\"; \n"}},{"id":"csharp-interpolated-hole-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x /* hole */} // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":25,"kind":"block","action":"remove"},{"start":35,"end":44,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x } // no\"; \n"}},{"id":"csharp-interpolated-hole-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"v={x // hole\n}\"; // remove\n","expect":{"valid":true,"comments":[{"start":15,"end":22,"kind":"line","action":"remove"},{"start":27,"end":36,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"v={x \n}\"; \n"}},{"id":"csharp-interpolated-format-clause","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $\"{x:D4 // no}\"; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = $\"{x:D4 // no}\"; \n"}},{"id":"csharp-verbatim-interpolated","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; // remove\n","expect":{"valid":true,"comments":[{"start":42,"end":51,"kind":"line","action":"remove"}],"output_utf8":"var s = $@\"a {x} // no\nb\"; var t = @$\"c\"; \n"}},{"id":"csharp-raw-string-quotes","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":40,"end":49,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\"three \"\"\" inside // no\"\"\"\"; \n"}},{"id":"csharp-raw-multiline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"\"\"\n body // no\n \"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":32,"end":41,"kind":"line","action":"remove"}],"output_utf8":"var s = \"\"\"\n body // no\n \"\"\"; \n"}},{"id":"csharp-raw-interpolated-dollar","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = $$\"\"\"{not a hole} {{x /* hole */}} // no\"\"\"; // remove\n","expect":{"valid":true,"comments":[{"start":30,"end":40,"kind":"block","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"var s = $$\"\"\"{not a hole} {{x }} // no\"\"\"; \n"}},{"id":"csharp-utf8-literal","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"bytes // no\"u8; // remove\n","expect":{"valid":true,"comments":[{"start":25,"end":34,"kind":"line","action":"remove"}],"output_utf8":"var s = \"bytes // no\"u8; \n"}},{"id":"csharp-string-escape-carries-a-newline","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var s = \"a\\\nb // no\"; // remove\n","expect":{"valid":true,"comments":[{"start":22,"end":31,"kind":"line","action":"remove"}],"output_utf8":"var s = \"a\\\nb // no\"; \n"}},{"id":"csharp-character-literals","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"char a = '/'; char b = '\\''; char c = '\"'; // remove\n","expect":{"valid":true,"comments":[{"start":43,"end":52,"kind":"line","action":"remove"}],"output_utf8":"char a = '/'; char b = '\\''; char c = '\"'; \n"}},{"id":"csharp-preprocessor-if-with-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if DEBUG // kept\nvar a = 1; // remove\n#endif // tail\n","expect":{"valid":true,"comments":[{"start":10,"end":17,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"},{"start":46,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#if DEBUG \nvar a = 1; \n#endif \n"}},{"id":"csharp-region-text-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#region Name // not a comment\n#endregion // a comment\n","expect":{"valid":true,"comments":[{"start":41,"end":53,"kind":"line","action":"remove"}],"output_utf8":"#region Name // not a comment\n#endregion \n"}},{"id":"csharp-pragma-text","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#pragma warning disable 1591 // a comment\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":29,"end":41,"kind":"line","action":"remove"},{"start":53,"end":62,"kind":"line","action":"remove"}],"output_utf8":"#pragma warning disable 1591 \nvar a = 1; \n"}},{"id":"csharp-line-directive-string","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#line 1 \"a//b.cs\" // tail\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":18,"end":25,"kind":"line","action":"remove"},{"start":37,"end":46,"kind":"line","action":"remove"}],"output_utf8":"#line 1 \"a//b.cs\" \nvar a = 1; \n"}},{"id":"csharp-error-message-not-comment","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#error boom // no\n","expect":{"valid":true,"comments":[],"output_utf8":"#error boom // no\n"}},{"id":"csharp-directive-block-comment-is-not-one","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; // remove\n","expect":{"valid":true,"comments":[{"start":38,"end":47,"kind":"line","action":"remove"}],"output_utf8":"#if A /* no */ && B\n#endif\nvar a = 1; \n"}},{"id":"csharp-hash-after-code-is-not-a-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"var a = 1; #if X // no\n#endif\n","expect":{"valid":true,"comments":[],"output_utf8":"var a = 1; #if X // no\n#endif\n"}},{"id":"csharp-unicode-line-terminator","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_base64":"dmFyIGEgPSAxOyAvLyBj4oCodmFyIGIgPSAyOyAvLyByZW1vdmUK","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"},{"start":29,"end":38,"kind":"line","action":"remove"}],"output_base64":"dmFyIGEgPSAxOyDigKh2YXIgYiA9IDI7IAo="}},{"id":"csharp-auto-generated-directive","language":"csharp","operation":"transform","options":{"policy":"standard","layout":"lines"},"source_utf8":"//{x // c\n}
\n\n","expect":{"valid":true,"comments":[{"start":6,"end":10,"kind":"line","action":"remove"},{"start":17,"end":30,"kind":"html-comment","action":"keep"}],"output_utf8":"{x \n}
\n\n"}},{"id":"markdown-fences-and-inline-code","language":"markdown","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"```nope\n// not a comment\n```\n`// not either`\n /* nor this */\n","expect":{"valid":true,"comments":[]}},{"id":"perl-ambiguous-slash-after-paren","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"sub f { 1 }\nf() /a#b/;\nmy $x = (2) / 2; # division\n","expect":{"valid":false,"comments":[]}},{"id":"perl-compound-opaque-sections","language":"perl","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"my @items = (1);\nprint $#items, $^X; # variables\nmy $q = \"escaped \\\" # opaque\"; # quote\n$x =~ s/foo#one/bar#two/g; # substitution\nprint << \"ONE\", <<~'TWO';\n# first body\nONE\n # second body\n TWO\n=pod\n# pod body\n=cutlery\n# still pod\n=cut\nformat STDOUT =\n@<<<<<<<<\n# picture body\n.\n# after format\n__DATA__\n# data body\n","expect":{"valid":true,"comments":[{"start":37,"end":48,"kind":"line","action":"remove"},{"start":80,"end":87,"kind":"line","action":"remove"},{"start":115,"end":129,"kind":"line","action":"remove"},{"start":281,"end":295,"kind":"line","action":"remove"}]}},{"id":"scss-interpolation-in-string-and-url","language":"css","dialect":"scss","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a { x: \"#{1 /* string */}\"; y: url( \"#{2 /* url */}\" ); z: url(foo\\)bar//opaque); // outer\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":25,"kind":"block","action":"remove"},{"start":42,"end":51,"kind":"block","action":"remove"},{"start":83,"end":91,"kind":"line","action":"remove"}]}},{"id":"sass-silent-comment-indented-body","language":"css","dialect":"sass","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":".a\n // parent\n color: red\n width: 1px\n color: blue\n// root\n nested: yes\n.b\n color: green\n","expect":{"valid":true,"comments":[{"start":5,"end":46,"kind":"line","action":"remove"},{"start":61,"end":82,"kind":"line","action":"remove"}]}},{"id":"vue-exact-attributes-directives-and-nested-v-pre","language":"vue","operation":"scan","options":{"policy":"standard","layout":"lines"},"source_utf8":"x
\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"html-comment","action":"rewrite"}],"output_utf8":"\nx
\n"}},{"id":"profile-longest-token-wins-over-declaration-order","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"//// module\n/// item\n// remark\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"doc-line","action":"keep"},{"start":12,"end":20,"kind":"doc-line","action":"keep"},{"start":21,"end":30,"kind":"line","action":"remove"}]}},{"id":"profile-prefix-delimiters-are-not-ambiguous","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"///doc\n//remark\n","expect":{"valid":true,"comments":[{"start":0,"end":6,"kind":"doc-line","action":"keep"},{"start":7,"end":15,"kind":"line","action":"remove"}]}},{"id":"profile-a-string-still-hides-a-comment-token","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"gleam","extensions":["gleam"],"line_comments":[{"start":"////","kind":"doc-line"},{"start":"///","kind":"doc-line"},{"start":"//","kind":"line"}],"block_comments":[],"strings":[{"start":"\"","end":"\"","escape":"\\","multiline":true}],"protected_patterns":[]},"source_utf8":"pub const s = \"// not a comment\"\n// a comment\n","expect":{"valid":true,"comments":[{"start":33,"end":45,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-dashes-open-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- a remark\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":11,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-an-operator-is-not-a-comment","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a --> b\nc <-- d\n","expect":{"valid":true,"comments":[{"start":11,"end":15,"kind":"line","action":"remove"}],"output_utf8":"a --> b\nc <\n"}},{"id":"profile-haskell-a-longer-run-of-dashes-is-still-a-comment","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"---x is a comment\ny = 2\n","expect":{"valid":true,"comments":[{"start":0,"end":17,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-longer-run-before-a-symbol-is-an-operator","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"a ----> b\n","expect":{"valid":true,"comments":[],"output_utf8":"a ----> b\n"}},{"id":"profile-haskell-haddock-continues-with-the-plain-opener","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | The first line is marked.\n-- The rest is not.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":30,"kind":"doc-line","action":"keep"},{"start":31,"end":52,"kind":"doc-line","action":"keep"}]}},{"id":"profile-haskell-a-blank-line-ends-the-continuation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\n\n-- an unrelated remark\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":21,"end":43,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-a-remark-below-code-is-not-documentation","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- | Documentation.\nadd = 1\n-- an unrelated remark\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"doc-line","action":"keep"},{"start":28,"end":50,"kind":"line","action":"remove"}]}},{"id":"profile-haskell-nesting-counts-the-pairing","language":"c","operation":"transform-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n","expect":{"valid":true,"comments":[{"start":0,"end":58,"kind":"doc-block","action":"keep"}],"output_utf8":"{-| Documentation.\n It nests {- like this -} properly.\n-}\ndata T = T\n"}},{"id":"profile-haskell-a-string-hides-both-comment-forms","language":"c","operation":"scan-profile","options":{"policy":"conservative"},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"-- ^","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-|","end":"-}","nested":true,"kind":"doc-block"},{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"s = \"-- not a comment, {- nor this -}\"\n-- a comment\n","expect":{"valid":true,"comments":[{"start":39,"end":51,"kind":"line","action":"remove"}]}},{"id":"profile-style-reads-the-profiles-own-marker","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"space_after_marker":true}},"profile":{"name":"haskell","extensions":["hs"],"doc_continuation":true,"line_comments":[{"start":"-- |","kind":"doc-line"},{"start":"--","forbidden_after":"!#$%&*+./<=>?@\\^|~:-","kind":"line"}],"block_comments":[{"start":"{-","end":"-}","nested":true,"kind":"block"}],"strings":[{"start":"\"","end":"\"","escape":"\\"}],"protected_patterns":[]},"source_utf8":"-- |Documentation written against its marker.\nadd = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":45,"kind":"doc-line","action":"rewrite"}],"output_utf8":"-- | Documentation written against its marker.\nadd = 1\n"}},{"id":"wrap-joins-a-break-nobody-meant","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken\n/// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":84,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A sentence that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-breaks-after-every-sentence","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second on the same line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence.\n/// And a second on the same line.\nfn a() {}\n"}},{"id":"wrap-keeps-a-break-after-a-clause","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":49,"kind":"doc-line","action":"keep"},{"start":50,"end":85,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// A clause ends here,\n/// and the break after it is kept.\nfn a() {}\n"}},{"id":"wrap-unwrap-joins-without-breaking-sentences","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"unwrap"}},"source_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was\n/// broken to fit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":78,"kind":"doc-line","action":"keep"},{"start":79,"end":97,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// One sentence. And a second.\n/// A third that was broken to fit.\nfn a() {}\n"}},{"id":"wrap-leaves-a-fenced-code-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps\n/// here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":46,"kind":"doc-line","action":"keep"},{"start":47,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":68,"kind":"doc-line","action":"keep"},{"start":69,"end":83,"kind":"doc-line","action":"keep"},{"start":84,"end":109,"kind":"doc-line","action":"keep"},{"start":110,"end":117,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose that wraps here.\n///\n/// ```\n/// let x = 1;\n/// let y = 2. Not prose.\n/// ```\nfn a() {}\n"}},{"id":"wrap-leaves-a-section-heading","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":38,"kind":"doc-line","action":"keep"},{"start":39,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// # Errors\n/// The first line under the heading.\nfn a() {}\n"}},{"id":"wrap-leaves-a-link-reference-definition","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":70,"kind":"doc-line","action":"keep"},{"start":71,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: when it cannot be done.\n/// Ordinary prose.\nfn a() {}\n"}},{"id":"wrap-reaches-a-list-item-and-keeps-its-indentation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps\n/// onto the next line. And a second sentence.\n/// - another\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":56,"kind":"doc-line","action":"keep"},{"start":57,"end":105,"kind":"doc-line","action":"keep"},{"start":106,"end":119,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item whose text wraps onto the next line.\n/// And a second sentence.\n/// - another\nfn a() {}\n"}},{"id":"wrap-leaves-a-table","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":39,"kind":"doc-line","action":"keep"},{"start":40,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":67,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// | a | b |\n/// |---|---|\n/// | 1 | 2 |\nfn a() {}\n"}},{"id":"wrap-does-not-break-inside-a-host-name","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details. Version 1.5 is fine.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":93,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// See https://example.com/a.b/c for details.\n/// Version 1.5 is fine.\nfn a() {}\n"}},{"id":"wrap-does-not-break-after-an-abbreviation","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence. J. Smith neither.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Abbreviations e.g. this one do not end a sentence.\n/// J. Smith neither.\nfn a() {}\n"}},{"id":"wrap-breaks-a-cjk-sentence-without-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。これは二文目。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文です。\n/// これは二文目。\nfn a() {}\n"}},{"id":"wrap-joins-cjk-without-inserting-a-space","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで\n/// 折り返されている。\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":57,"kind":"doc-line","action":"keep"},{"start":58,"end":89,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 日本語の文がここで折り返されている。\nfn a() {}\n"}},{"id":"wrap-reaches-a-line-comment-run-too","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken\n// to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"line","action":"keep"},{"start":54,"end":80,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n// A remark that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-leaves-a-run-whose-lines-open-differently","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":90,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n//! and an inner doc line under it.\nfn a() {}\n"}},{"id":"wrap-reaches-a-block-comment","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":73,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line. */\nfn a() {}\n"}},{"id":"wrap-leaves-the-first-two-lines-alone","language":"python","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":26,"kind":"line","action":"keep"},{"start":27,"end":52,"kind":"line","action":"keep"}],"output_utf8":"# A remark that was broken\n# to keep the line short.\nx = 1\n"}},{"id":"wrap-keeps-crlf-endings","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken\r\n/// to keep the line short.\r\nfn a() {}\r\n","expect":{"valid":true,"comments":[{"start":28,"end":58,"kind":"doc-line","action":"keep"},{"start":60,"end":87,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\r\nfn also() {}\r\n/// A sentence that was broken to keep the line short.\r\nfn a() {}\r\n"}},{"id":"wrap-and-removal-in-one-file","language":"rust","operation":"transform","options":{"policy":"conservative","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps\n/// onto a second line.\nfn a() {}\n// a remark\nfn b() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":54,"kind":"doc-line","action":"keep"},{"start":55,"end":78,"kind":"doc-line","action":"keep"},{"start":89,"end":100,"kind":"line","action":"remove"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Documentation that wraps onto a second line.\nfn a() {}\n\nfn b() {}\n"}},{"id":"wrap-leaves-a-comment-beside-code","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":37,"end":61,"kind":"line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\nlet x = 1; // a remark that is long\nfn a() {}\n"}},{"id":"wrap-reaches-the-first-line-where-no-preamble-is-read","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"//! Module documentation that was broken\n//! to keep the line short.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":40,"kind":"doc-line","action":"keep"},{"start":41,"end":68,"kind":"doc-line","action":"keep"}],"output_utf8":"//! Module documentation that was broken to keep the line short.\nfn a() {}\n"}},{"id":"wrap-keeps-a-block-closer-on-its-own-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps\n * onto a second line.\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":74,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* A block that wraps onto a second line.\n */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-that-fits-on-one-line","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":58,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One sentence. And another. */\nfn a() {}\n"}},{"id":"wrap-aligns-an-ocaml-block-under-its-text","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines\n are aligned under the text. And a second sentence. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":118,"kind":"block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(* A block whose continuation lines are aligned under the text.\n And a second sentence. *)\nlet a = 3\n"}},{"id":"wrap-reaches-an-ocaml-documentation-block","language":"ocaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps\n onto a second line. *)\nlet a = 3\n","expect":{"valid":true,"comments":[{"start":26,"end":80,"kind":"doc-block","action":"keep"}],"output_utf8":"let head = 1\nlet also = 2\n(** Documentation that wraps onto a second line. *)\nlet a = 3\n"}},{"id":"wrap-keeps-a-blank-line-inside-a-block","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps\n * onto a line.\n *\n * A second paragraph. */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":98,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* One paragraph that wraps onto a line.\n *\n * A second paragraph. */\nfn a() {}\n"}},{"id":"wrap-leaves-a-block-whose-interior-is-a-code-example","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":100,"kind":"block","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/* An example:\n *\n * ```\n * let x = 1;\n * let y = 2. Not prose.\n * ```\n */\nfn a() {}\n"}},{"id":"wrap-leaves-an-example-indented-under-an-item","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps\n/// onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":50,"kind":"doc-line","action":"keep"},{"start":51,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":73,"kind":"doc-line","action":"keep"},{"start":74,"end":92,"kind":"doc-line","action":"keep"},{"start":93,"end":96,"kind":"doc-line","action":"keep"},{"start":97,"end":107,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - an item that wraps onto a line:\n///\n/// let x = 1;\n///\n/// After.\nfn a() {}\n"}},{"id":"wrap-keeps-a-nested-list-nested","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps\n/// onto a line\n/// - inner item that wraps\n/// onto a line\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":53,"kind":"doc-line","action":"keep"},{"start":54,"end":71,"kind":"doc-line","action":"keep"},{"start":72,"end":101,"kind":"doc-line","action":"keep"},{"start":102,"end":121,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// - outer item that wraps onto a line\n/// - inner item that wraps onto a line\nfn a() {}\n"}},{"id":"wrap-splits-an-item-into-sentences-under-its-marker","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence. And a second.\n/// 2. Another.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":60,"kind":"doc-line","action":"keep"},{"start":61,"end":76,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// 1. One sentence.\n/// And a second.\n/// 2. Another.\nfn a() {}\n"}},{"id":"wrap-splits-a-run-at-a-line-a-style-rule-cannot-reach","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps\n/// onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps\n/// onto a line.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":52,"kind":"doc-line","action":"keep"},{"start":53,"end":69,"kind":"doc-line","action":"keep"},{"start":70,"end":104,"kind":"directive","action":"keep"},{"start":105,"end":131,"kind":"doc-line","action":"keep"},{"start":132,"end":148,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// Prose above that wraps onto a line.\n/// noqa is a word a linter reads.\n/// Prose below that wraps onto a line.\nfn a() {}\n"}},{"id":"wrap-joins-a-sentence-that-opens-with-an-intra-doc-link","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs\n/// to, because that run is longer than the limit.\nfn a() {}\n","expect":{"valid":true,"comments":[{"start":26,"end":90,"kind":"doc-line","action":"keep"},{"start":91,"end":141,"kind":"doc-line","action":"keep"}],"output_utf8":"fn head() {}\nfn also() {}\n/// [`Thing::fail`]: removed with the run of comments it belongs to, because that run is longer than the limit.\nfn a() {}\n"}},{"id":"wrap-reaches-a-markdown-paragraph","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"A paragraph that wraps\nacross two lines. And a second sentence.\n","expect":{"valid":true,"comments":[],"output_utf8":"A paragraph that wraps across two lines.\nAnd a second sentence.\n"}},{"id":"wrap-leaves-a-markdown-fence","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n```\ncode that wraps\nshould not join.\n```\n","expect":{"valid":true,"comments":[],"output_utf8":"Prose that wraps across lines.\n\n```\ncode that wraps\nshould not join.\n```\n"}},{"id":"wrap-leaves-markdown-front-matter","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"---\ntitle: a document\nsummary: two lines\n---\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-heading-and-table","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps\nacross lines.\n","expect":{"valid":true,"comments":[],"output_utf8":"# A heading that is long\n\n| a | b |\n|---|---|\n| 1 | 2 |\n\nProse that wraps across lines.\n"}},{"id":"wrap-leaves-a-markdown-html-comment-to-the-comment-path","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"Prose that wraps\nacross lines.\n\n\n","expect":{"valid":true,"comments":[{"start":32,"end":80,"kind":"html-comment","action":"keep"}],"output_utf8":"Prose that wraps across lines.\n\n\n"}},{"id":"wrap-reaches-a-markdown-list-item","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- an item that wraps\n onto the next line. And a second sentence.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- an item that wraps onto the next line.\n And a second sentence.\n- another\n"}},{"id":"wrap-keeps-an-item-open-across-a-clause-break","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps\n onto two more lines.\n- another\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n the rest of it wraps onto two more lines.\n- another\n"}},{"id":"wrap-writes-a-continued-item-under-its-marker","language":"markdown","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"- An item whose first line ends at a clause:\n a second sentence. And a third.\n","expect":{"valid":true,"comments":[],"output_utf8":"- An item whose first line ends at a clause:\n a second sentence.\n And a third.\n"}},{"id":"wrap-keeps-the-indentation-the-source-wrote","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// A sentence that was broken\n /// to keep the line short.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"},{"start":48,"end":75,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// A sentence that was broken to keep the line short.\n fn a() {}\n}\n"}},{"id":"wrap-indents-the-lines-a-split-opens","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"impl T {\n /// One sentence. Another one.\n fn a() {}\n}\n","expect":{"valid":true,"comments":[{"start":13,"end":43,"kind":"doc-line","action":"keep"}],"output_utf8":"impl T {\n /// One sentence.\n /// Another one.\n fn a() {}\n}\n"}},{"id":"wrap-refuses-a-run-whose-lines-sit-at-different-columns","language":"yaml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n","expect":{"valid":true,"comments":[{"start":6,"end":19,"kind":"line","action":"keep"},{"start":24,"end":49,"kind":"line","action":"keep"},{"start":54,"end":75,"kind":"line","action":"keep"}],"output_utf8":"a: 1\n\n# - script: |\n # echo building the image\n # docker build --rm .\n\nb: 2\n"}},{"id":"declarative-profile-reaches-the-style-axis-too","language":"c","operation":"transform-profile","options":{"policy":"none","style":{"wrap":"sentence"},"layout":"lines"},"profile":{"name":"demo","extensions":["demo"],"line_comments":[{"start":"//","kind":"line"}],"block_comments":[],"strings":[],"protected_patterns":[]},"source_utf8":"call()\n// A remark. Another one.\ncall()\n","expect":{"valid":true,"comments":[{"start":7,"end":32,"kind":"line","action":"keep"}],"output_utf8":"call()\n// A remark.\n// Another one.\ncall()\n"}},{"id":"a-scan-records-the-run-it-rewrote","language":"rust","operation":"scan","options":{"policy":"none","style":{"wrap":"sentence"}},"source_utf8":"fn head() {}\n// A remark. Another one.\nfn also() {}\n","expect":{"valid":true,"comments":[{"start":13,"end":38,"kind":"line","action":"keep"}]}},{"id":"wrap-leaves-a-labelled-divider-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n","expect":{"valid":true,"comments":[{"start":4,"end":58,"kind":"line","action":"keep"},{"start":59,"end":117,"kind":"line","action":"keep"}],"output_utf8":"x=1\n# --- keybindings ------------------------------------\n# Splits, mapped the same way the other machine maps them.\ny=2\n"}},{"id":"wrap-leaves-a-mise-task-header-alone","language":"shell","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n","expect":{"valid":true,"comments":[{"start":0,"end":19,"kind":"shebang","action":"keep"},{"start":20,"end":96,"kind":"load-bearing","action":"keep"},{"start":97,"end":155,"kind":"load-bearing","action":"keep"},{"start":156,"end":157,"kind":"line","action":"keep"},{"start":158,"end":199,"kind":"line","action":"keep"}],"output_utf8":"#!/usr/bin/env bash\n#MISE description=\"Audit signing posture across local git repos under $HOME\"\n#USAGE flag \"--fix-stale-hooks\" help=\"Remove legacy hooks\"\n#\n# Walks $HOME and audits each repository.\necho audit\n"}},{"id":"wrap-reads-a-label-as-a-marker-with-no-tag-list","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# NOTE: The policy this machine holds every commit to, as a setting\n# NOTE: rather than as a gate's own opinion. It merges under a project's.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":67,"kind":"line","action":"keep"},{"start":68,"end":141,"kind":"line","action":"keep"}],"output_utf8":"# NOTE: The policy this machine holds every commit to, as a setting rather than as a gate's own opinion.\n# NOTE: It merges under a project's.\nversion = 1\n"}},{"id":"wrap-does-not-read-an-ordinary-word-as-a-marker","language":"toml","operation":"transform","options":{"policy":"none","layout":"lines","style":{"wrap":"sentence"}},"source_utf8":"# The cat sat on the mat and then\n# the dog ran away. A second sentence.\nversion = 1\n","expect":{"valid":true,"comments":[{"start":0,"end":33,"kind":"line","action":"keep"},{"start":34,"end":72,"kind":"line","action":"keep"}],"output_utf8":"# The cat sat on the mat and then the dog ran away.\n# A second sentence.\nversion = 1\n"}},{"id":"allow-rules-do-not-reach-policy-none","language":"rust","operation":"scan","options":{"policy":"none","allow":{"tags":["NOTE"],"max_lines":1,"trailing":false}},"source_utf8":"// NOTE: one line.\npub fn a() {}\n\n// NOTE: goes on\n// NOTE: and on.\npub fn b() {}\n\npub fn c() {} // NOTE: beside code\n\n// plain\npub fn d() {}\n","expect":{"valid":true,"comments":[{"start":0,"end":18,"kind":"line","action":"keep"},{"start":34,"end":50,"kind":"line","action":"keep"},{"start":51,"end":67,"kind":"line","action":"keep"},{"start":97,"end":117,"kind":"line","action":"keep"},{"start":119,"end":127,"kind":"line","action":"keep"}]}},{"id":"policy-none-restyles-what-it-refuses-to-remove","language":"rust","operation":"transform","options":{"policy":"none","layout":"lines","allow":{"max_lines":1,"trailing":false},"style":{"wrap":"sentence"}},"source_utf8":"// A first sentence wrapped to a\n// column. A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n","expect":{"valid":true,"comments":[{"start":0,"end":32,"kind":"line","action":"keep"},{"start":33,"end":62,"kind":"line","action":"keep"},{"start":92,"end":106,"kind":"line","action":"keep"}],"output_utf8":"// A first sentence wrapped to a column.\n// A second sentence.\npub fn a() {}\n\npub fn b() {} // beside code\n"}}]} diff --git a/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 \"