Control inline option scope and visibility
masterThe scope of an inline option depends on its placement:
- On a line with code: Only that specific line is affected.
- On a line without code: Everything from that line until the end of the current closure (e.g., the end of a function or block) is affected.
- At the top of a file: The entire file is affected.
For precise control over when options are active, use the push and pop directives to create a temporary scope for configuration.
-- luacheck: push ignore foo
foo() -- No warning.
-- luacheck: pop
foo() -- Warning is emitted.
-- Example of closure scope:
local function f()
-- luacheck: globals g3
g3() -- No warning.
end
g3() -- Warning is emitted because the option only affected function f.