Check if module was required to a local variable
According to https://luacheck.readthedocs.io/en/stable/warnings.html, there's no warnings for cases when a module being required is not assigned to a local variable, e.g.
require 'foo.bar'
instead of
local bar = require 'foo.bar'
Is it possible to add one? I would love to have a separate warning code for this because I need to differ such cases from "113 - Accessing an undefined global variable".
Thank you.
This can be added, yes. In case require argument is a literal it could use it as the warning "name" for filtering, so that something like ignore = {"xxx"}; only = {"xxx/foo%.bar"} enabled the warning only for foo.bar module (where xxx is the new warning code). Or perhaps the warning should be disabled by default, then the ignore option is not needed.
Sorry, I don't understand.
If I want to spot all the places (without knowing which modules are actually being required) where require is called without saving its result to a local variable, how do I do that?
Is it possible with existing config options?
Petya? Some help would be much appreciated!