1

I am currently trying to configure pylint to ensure high coding standards in a particular project. My problem is that somehow I am not really able to configure pylint the way I would like. First I tried to use the normal settings in VSC to configure pylint, this was done as follows (short example):

    "python.linting.enabled": true,
            "python.linting.mypyEnabled": true,
            "python.linting.pylintEnabled": true,
            "python.linting.pylintUseMinimalCheckers": false,
        "python.linting.lintOnSave": true,
        "python.linting.pylintArgs": [
                "--max-line-length= 120",
                "--disable=C0116,C0115,C0114"
            ]

This configuration seemed to work, but it only does directly in the VSC editor (it gives hints in VSC but no report via terminal/file) and somehow it does not catch all of the problems.

Therefore I decided to try useing a .pylintcr file. I generated it via pylint --generate-rcfile, but I couldn't find the newly created file, after numerous tries, I finally managed to create the file where I wanted it to be. Still it seems another configuration file is beeing used and the one in the correct location is basically useless.

Is there any way, how I could locate the .pylinrc file in use and move it, since I need to have the pylintrc file in Git, it needs to be located in the same project?

Is it possible to run pylint (and/or mypy) and receive hints in VSC as well as getting an report via terminal/ report file?

Is there a way to make it possible to run pylintrc and mypy always together for e. g. after saving a file and still get the hints in VSC and a report?

Jan
  • 23
  • 1
  • 6

1 Answers1

1

When you're running pylint --generate-rcfile it's printing a text that can become your pylintrc if you save it inside a file. You can do it like this : pylint --generate-rcfile >pylintrc or copy paste the output in and save it in pylintrc then add it to your repository.

In order to point to your pylintrc in visual studio you can use:

"python.linting.pylintArgs": [
    "--rcfile=${env:HOME}/path/to/your/.pylintrc"
]
Pierre.Sassoulas
  • 3,733
  • 3
  • 33
  • 48
  • 1
    Okay thanks, this explains why there was now file in the first place. But doing it like that doesn't seems to work. For example after setting the maximum line length to 120, I still get an error which tells me lines with for example 103 chars are to long since the limit is 100. Also I think it should be `pylint --generate-rcfile >pylintrc` without the space it is not working. – Jan Jul 22 '21 at 06:52
  • pylint is not installed for me outside of vs code, if I install it it will be a different env. so what should I do? – Vincent Alex Jan 21 '23 at 19:51