[code-quality] Is it possilbe to run pyLint on a string

Skip Montanaro skip.montanaro at gmail.com
Fri Feb 27 20:25:37 CET 2015


On Fri, Feb 27, 2015 at 12:37 PM, Piotr Kupczyk <pio.kupczyk at gmail.com> wrote:
> thanks for reply. I am actually looking for an option to not create
> any files (even temporary) at all.
> Is there still an option to use pylint on a string?

Now that I'm not responding from my phone, I could more easily poke
around the docs and code. Looking at the code, I see nothing which
obviously suggests there is a pylint API which accepts a string to be
linted. The code in .../pylint/lint.py seems to be very strongly tied
to operation on files from the command line. If you want to execute it
programmatically, I think you're going to have to write your string to
a file, construct a list of strings which mimics sys.argv[1:], then
execute

    from pylint.lint import Run
    Run(args)

and clean up with its finished.

Skip


More information about the code-quality mailing list