Skip to content

Commit

Permalink
Update warning code
Browse files Browse the repository at this point in the history
  • Loading branch information
arichard4 committed Dec 17, 2022
1 parent c899b72 commit ea2b336
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docsrc/warnings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Code Description
021 An invalid inline option.
022 An unpaired inline push directive.
023 An unpaired inline pop directive.
033 Invalid use of a compound operator. (Lua doesn't support compound operator by default; if using an extension that does, please set the operators option.)
111 Setting an undefined global variable.
112 Mutating an undefined global variable.
113 Accessing an undefined global variable.
Expand Down
2 changes: 1 addition & 1 deletion src/luacheck/filter.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ local function passes_filter(normalized_options, warning)
end

warning.max_complexity = max_complexity
elseif warning.code == "533" then
elseif warning.code == "033" then
local operators = normalized_options.operators or {}
for _, op in ipairs(operators) do
if warning.operator == op then
Expand Down
4 changes: 2 additions & 2 deletions src/luacheck/stages/detect_compound_operators.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local core_utils = require "luacheck.core_utils"
local stage = {}

stage.warnings = {
["533"] = {message_format = "assignment uses compound operator {operator}", fields = {"operator"}},
["033"] = {message_format = "assignment uses compound operator {operator}", fields = {"operator"}},
}

local reverse_compound_operators = {
Expand All @@ -24,7 +24,7 @@ local reverse_compound_operators = {

local function check_node(chstate, node)
local operator = reverse_compound_operators[node[1]]
chstate:warn_range("533", node, {operator = operator})
chstate:warn_range("033", node, {operator = operator})
end

function stage.run(chstate)
Expand Down

0 comments on commit ea2b336

Please sign in to comment.