Is it possilbe to run pyLint on a string

I am wondering whether it is possible to run pylint on a string containing code. I checked that it is possible in flake8 i.e. http://flake8.readthedocs.org/en/latest/api.html#flake8.main.check_code Is that possible in pylint? Thanks

Hi Skip, 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? Cheers, Piotr. 2015-02-27 3:34 GMT+01:00 Skip Montanaro <skip.montanaro@gmail.com>:
I am wondering whether it is possible to run pylint on a string containing code.
You could write the string to a temp file, and run pylint on that file.
Skip

On Fri, Feb 27, 2015 at 12:37 PM, Piotr Kupczyk <pio.kupczyk@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
participants (2)
-
Piotr Kupczyk
-
Skip Montanaro