Skip to content

Commit f13947f

Browse files
committed
fix(lint): fix whitespace linter issues
1 parent 84dbe94 commit f13947f

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

spec/collect_all_errors_spec.lua

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,27 @@ local function assert_contains_all_error_entries(actual_errors, expected_entries
3737
end
3838
actual_error_map[key] = true
3939
end
40-
40+
4141
-- Check each expected entry exists
4242
for _, expected in ipairs(expected_entries) do
4343
local key = expected.schema_path .. ":" .. (expected.instance_path or "") .. ":" .. expected.error
4444
if not actual_error_map[key] then
4545
local actual_str = "[\n"
4646
for _, err_entry in ipairs(actual_errors) do
4747
if type(err_entry) == "table" and err_entry.schema_path and err_entry.error then
48-
actual_str = actual_str .. string.format(' {schema_path="%s", instance_path="%s", error="%s"},\n',
48+
actual_str = actual_str .. string.format(' {schema_path="%s", instance_path="%s", error="%s"},\n',
4949
err_entry.schema_path, err_entry.instance_path or "", err_entry.error)
5050
end
5151
end
5252
actual_str = actual_str .. "]"
53-
53+
5454
error(string.format(
5555
"Expected error entry not found:\n Expected: {schema_path=\"%s\", instance_path=\"%s\", error=\"%s\"}\n Actual errors: %s",
5656
expected.schema_path, expected.instance_path or "", expected.error, actual_str
5757
))
5858
end
5959
end
60-
60+
6161
-- Also check that we have the expected number of errors
6262
if #actual_errors ~= #expected_entries then
6363
error(string.format(
@@ -74,7 +74,7 @@ local options = {
7474
describe("[collect_all_errors - specialized tests]", function()
7575
json.decode_array_with_array_mt(true)
7676
local test_file = 'spec/extra/errors/collect_all_errors.json'
77-
77+
7878
for _, suite in ipairs(readjson(test_file)) do
7979
describe("["..test_file.."] "..suite.description .. ":", function()
8080
local schema = suite.schema
@@ -97,11 +97,11 @@ describe("[collect_all_errors - specialized tests]", function()
9797
assert.has.no.error(function()
9898
result, errors = validator(case.data)
9999
end)
100-
100+
101101
-- Verify that result is false and errors is a table
102102
assert.is_false(result)
103103
assert.is_table(errors)
104-
104+
105105
-- Check error entries for collect_all_errors.json tests
106106
if case.error_entries then
107107
assert_contains_all_error_entries(errors, case.error_entries)

spec/suite_spec.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ describe("[JSON schema Draft 4 with collect_all_errors]", function()
280280
break
281281
end
282282
end
283-
if flag then
284-
break
283+
if flag then
284+
break
285285
end
286286
end
287287
end

src/resty/ljsonschema/init.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,15 @@ function codectx_mt:handle_error(indent, error_msg, schema_path, instance_path)
227227
self:stmt(sformat('%stable.insert(errors, {schema_path = %s, instance_path = %s, error = %s})', indent, schema_path, instance_path, error_msg))
228228
else
229229
self:stmt(sformat('%sreturn false, %s', indent, error_msg))
230-
end
230+
end
231231
end
232232

233233
function codectx_mt:merge_child_errors(indent, err_var, path_prefix, instance_prefix)
234234
indent = indent or ''
235235
if self._root._collect_all_errors then
236236

237237
self:stmt(sformat('%sif type(%s) == "table" then', indent, err_var))
238-
238+
239239
self:stmt(sformat('%s for _, sub_err in ipairs(%s) do', indent, err_var))
240240
if path_prefix and path_prefix ~= '' then
241241
-- 47 is the ASCII code for '/'
@@ -908,7 +908,7 @@ generate_validator = function(ctx, schema)
908908
local format_escaped_pattern = string.gsub(schema.pattern, "%%", "%%%%")
909909

910910
ctx:stmt(sformat(' if not %s(%s, %q) then', ctx:libfunc('custom.match_pattern'), ctx:param(1), schema.pattern))
911-
ctx:handle_error(' ', sformat('%s([[failed to match pattern ]] .. %q .. [[ with %%q]], %s)',
911+
ctx:handle_error(' ', sformat('%s([[failed to match pattern ]] .. %q .. [[ with %%q]], %s)',
912912
ctx:libfunc('string.format'), format_escaped_pattern, ctx:param(1)), '"/pattern"')
913913
ctx:stmt( ' end')
914914
end
@@ -1008,7 +1008,7 @@ generate_validator = function(ctx, schema)
10081008
ctx:stmt( ' end')
10091009
if ctx._root._collect_all_errors and schema.format == "date-time" then
10101010
ctx:stmt( ' if record_err then')
1011-
ctx:stmt(sformat( ' table.insert(errors, {schema_path = "/format", instance_path = "", error = %s})',
1011+
ctx:stmt(sformat( ' table.insert(errors, {schema_path = "/format", instance_path = "", error = %s})',
10121012
sformat('%s([[expected valid %q, got %%q]], %s)', ctx:libfunc('string.format'), schema.format, ctx:param(1))))
10131013
ctx:stmt( ' end')
10141014
ctx:stmt( ' end')
@@ -1221,7 +1221,7 @@ local _M = {
12211221
-- There is no default implementation: this function must be provided if
12221222
-- resolving external schemas is required. The function signature should be: `function(url)`
12231223
-- @tparam[opt] bool custom.collect_all_errors If set to true, the validator will collect all validation errors
1224-
-- instead of stopping at the first one. The error message contains:
1224+
-- instead of stopping at the first one. The error message contains:
12251225
-- * schema_path: Path to the JSON Schema keyword that failed validation.
12261226
-- * instance_path: Path to the value that failed validation.
12271227
-- * error: The error message.

0 commit comments

Comments
 (0)