Hey, On Fri, Oct 02, 2020 at 06:11:26PM -0700, William Tracy wrote: > Hello, > > I've been digging around the Pylint codebase trying to understand how the > scope of enable/disable pragmas is handled. > > Several checkers directly reference utils/pragma_parser.py, but the code > doesn't seem to go any deeper than checking whether the current line > contains a pragma. I can't see that pragma_parser.py is referenced anywhere > else in the codebase. > > Where is the code for managing scope? Is it hiding under a different name? > Is it somehow handled in astroid rather than in Pylint itself? > > Thanks for any answers, and thanks for providing such a useful tool! > > William Tracy
As far as I know, it's all in pylint. The pragma_parser module is used in pylint.lint.pylinter in process_tokens which then calls 'meth'. That is coming from self._options_methods, so for a "# pylint: disable=..." call, that'd be self.disable. That is defined via a mixin in pylint.message.message_handler_mix_in. Via _set_msg_status -> _set_one_msg_status, that calls self.file_state.set_msg_status(). Finally, you'll end up in pylint.utils.file_state where it looks like the answer to your question is in _collect_block_lines. Florian -- m...@the-compiler.org (Mail/XMPP) | https://www.qutebrowser.org https://bruhin.software/ | https://github.com/sponsors/The-Compiler/ GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/
signature.asc
Description: PGP signature
_______________________________________________ code-quality mailing list -- code-quality@python.org To unsubscribe send an email to code-quality-le...@python.org https://mail.python.org/mailman3/lists/code-quality.python.org/ Member address: arch...@mail-archive.com