Hi Mats,

I can't speak for pylint, but Flake8 allows you to specify --builtins
when checking things (which we use to alter PyFlakes' understanding of
what is a built-in). Based on what you described, I think that would
allow you to do something with Flake8 locally or to steal some of the
Flake8 code to make your own `scons --check`.

Cheers,
Ian

On Thu, Oct 17, 2019 at 11:25 AM Mats Wichmann <m...@wichmann.us> wrote:
>
>
> I'm fishing for pointers here, this isn't really a specific question I'm
> expecting a magic answer to - though one such would certainly be
> gratefully accepted :)
>
> I work on the scons project - scons is a software build system tool,
> which is controlled by configuration scripts which are written in
> Python; scons is itself written in Python as well. It would be nice to
> have the ability for users to be able to check their configuration
> scripts for errors, poor programming style, etc. We certainly get enough
> questions about people who have actually botched the Python in their
> scripts, rather than finding errors in scons itself.
>
> However - scons is not a Python module that you import to make its
> methods and attributes visible.  Rather you run scons the program, and
> it finds the build scripts and interprets them using Python within the
> context of the already running program (i.e. exec(compile(scriptdata,
> ... ). That means if you run, for example, pylint on a perfectly valid
> script, it will certainly complain, because of the use of the scons
> "API" which will be well known during the run context but completely
> unknown to a static checker tool that does not operate in that context.
>
> So the scons model seems to be at odds with how all of the checkers I've
> looked at operate. I'm thinking that any possible way forward would be
> to have the checker operate in the scons context - that is, rather than
> expecting to run it from the command line, it would be activated by
> something like "scons --check".  Anybody have any ideas how one could
> adapt something to this model? How would one teach a checker what it
> needs to know about the API? Or is it simpler than I'm making it out to be?
>
>
>
> thanks
>
> -- mats
> _______________________________________________
> 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/
_______________________________________________
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/

Reply via email to