I am developing Python scripts which run inside a Jython interpreter. This interpreter sets certain global variables, which I use inside the script.
Pylint of course does not know these variables, so it reports errors all over the place.
Is there a way of making pylint aware that there are certain variables defined outside of its scope?
Alternatively, is there a way that I can define the unknown variables to pylint?
I tried something like
if not globals().has_key('SOME_EXTERNAL_GLOBAL'):
globals()['SOME_EXTERNAL_GLOBAL'] = None
But that did not help (pylint seems to ignore black magic done to globals()).
You have several options:
additional-builtins:
List of additional names supposed to be defined in builtins. Remember that you should avoid to define new builtins when possible.
# pylint: disable=E0602
comment on top of the file to disable undefined-variable
check in the file# pylint: disable=E0602
comment in the code where the variable is used--disable-msg=E0602
optionAlso see: