ludic fmt for editors: --lint --json, and a buffer on stdin (R9)
ludic-fmt --lint --json prints the violations --lint reports as one JSON array on stdout,
[{file, line, col, rule, message}] ordered by file, line and column (col where the rule knows it),
the summary on stderr, --lint's exit status, and never rewrites the baseline. ludic-fmt - refuses a
buffer that does not read as Ludic (a string/template/key literal left open, a bracket never closed
or closed by the wrong one) with exit 2 and name:line:col on stderr; - --lint judges a buffer as the
file --stdin-name names (--stdin-rel: that path relative to the project), against its baseline and
lint paths. ludic fmt --lint and ludic fmt - run it from the nearest package.ludic upwards (from
--stdin-name's directory when given). Hooks read nothing and write to stderr under --json or -.
Regression cases added to test-tools and ludic-dev test (fmt_editor_cases), not run.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c804c4b0ee
commit
047bdf4189
13 changed files with 405 additions and 17 deletions
|
|
@ -22,6 +22,7 @@ var lr_file: []string = new []string
|
|||
var lr_rule: []string = new []string
|
||||
var lr_line: []int = new []int
|
||||
var lr_msg: []string = new []string
|
||||
var lr_col: []int = new []int # 1-based byte column, 0 when the rule has none (a file's length)
|
||||
|
||||
function lt_atoi(s: string) -> int {
|
||||
var n = 0
|
||||
|
|
@ -103,9 +104,11 @@ function lint_config() -> bool {
|
|||
}
|
||||
return any
|
||||
}
|
||||
function lt_report(path: string, rule: string, line: int, msg: string) -> void {
|
||||
function lt_report(path: string, rule: string, line: int, msg: string) -> void { lt_report_at(path, rule, line, 0, msg) }
|
||||
function lt_report_at(path: string, rule: string, line: int, col: int, msg: string) -> void {
|
||||
push(lr_file, path)
|
||||
push(lr_rule, rule)
|
||||
push(lr_line, line)
|
||||
push(lr_col, col)
|
||||
push(lr_msg, msg)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue