refactor: apply stylua formatting to new preset code

This commit is contained in:
Barrett Ruth 2026-03-04 13:54:19 -05:00
parent 4665deee6c
commit f408136d5a
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
2 changed files with 4 additions and 12 deletions

View file

@ -98,8 +98,7 @@ end
local function parse_asciidoctor(output)
local diagnostics = {}
for line in output:gmatch('[^\r\n]+') do
local severity, _, lnum, msg =
line:match('^asciidoctor: (%u+): (.+): line (%d+): (.+)$')
local severity, _, lnum, msg = line:match('^asciidoctor: (%u+): (.+): line (%d+): (.+)$')
if lnum then
local sev = vim.diagnostic.severity.ERROR
if severity == 'WARNING' then

View file

@ -477,10 +477,7 @@ describe('presets', function()
end)
it('returns clean command', function()
assert.are.same(
{ 'rm', '-f', '/tmp/document.html' },
presets.asciidoctor.clean(adoc_ctx)
)
assert.are.same({ 'rm', '-f', '/tmp/document.html' }, presets.asciidoctor.clean(adoc_ctx))
end)
it('has open enabled', function()
@ -498,16 +495,12 @@ describe('presets', function()
assert.are.equal(1, #diagnostics)
assert.are.equal(7, diagnostics[1].lnum)
assert.are.equal(0, diagnostics[1].col)
assert.are.equal(
'invalid part, must have at least one section',
diagnostics[1].message
)
assert.are.equal('invalid part, must have at least one section', diagnostics[1].message)
assert.are.equal(vim.diagnostic.severity.ERROR, diagnostics[1].severity)
end)
it('parses warning messages', function()
local output =
'asciidoctor: WARNING: document.adoc: line 52: section title out of sequence'
local output = 'asciidoctor: WARNING: document.adoc: line 52: section title out of sequence'
local diagnostics = presets.asciidoctor.error_parser(output, adoc_ctx)
assert.are.equal(1, #diagnostics)
assert.are.equal(51, diagnostics[1].lnum)