def judged

bend-lint-rules@0.2.0.0 · layout/format.bend:2361

import bend-lint-rules@0.2.0.0/layout/format.bend as Format
import Base
import bend-lint-api@0.2.0.0/linter/lint.bend as Lint

2361def judged(same: Bool, +out: String, +text: String, +path: String) -> List<&2, Lint.Finding>:
2362  match same:
2363    case True{}:
2364      []
2365    case False{}:
2366      +at = differ(out, text, 0, True{})
2367      [
2368        Lint.Finding{
2369          Lint.Warning{},
2370          Lint.Span{path, at, line_end(String.drop(text, U32.to_nat(at)), at)},
2371          "Apply canonical formatting.",
2372          [
2373            Lint.Fix{
2374              "Format the file",
2375              [Lint.Replace{Lint.Span{path, 0, U32.from_nat(String.length(text))}, out}]
2376            }
2377          ]
2378        }
2379      ]

Uses (14)

Used by (1)