32

I am evaluating pylint as source code checker and I would like to customize the maximum number of characters on a single line.

I would like to use a configuration file. I've generated a template thanks to the --generate-rcfile command and I've made my modification.

I am trying to run pylint --rcfile=myfile.rc but I can see that my changes are not taken into account by pylint. I've tried different location for my file : \Python26\Scripts\ and pylint.d in my user folder without any success.

Does anybody know what I am doing wrong?

Is it possible to use the configration file with pylint-gui? I can't do it too?

martineau
  • 119,623
  • 25
  • 170
  • 301
luc
  • 41,928
  • 25
  • 127
  • 172

2 Answers2

30

On Windows 7, a .pylintrc file in your home directory (typically C:\Users\myusername) will be automatically recognized.

You can create a template using:

pylint --generate-rcfile > .pylintrc
Community
  • 1
  • 1
Flolagale
  • 1,300
  • 11
  • 7
  • 1
    You can create one without a dot as above and it works fine. E.g. `\Users\MyAccount\pylintrc` – AlG Oct 26 '16 at 13:03
  • 1
    @AIG, on Windows 10, without a dot didn't work for me but `\Users\MyAccount\.pylintrc` worked as intended. – Jona Oct 25 '17 at 14:45
  • For a list of recognised `.pylintrc` locations, see [*How do I disable a Pylint warning?*](https://stackoverflow.com/a/32672068/3357935) – Stevoisiak May 16 '18 at 15:24
  • `python -m pylint --generate-rcfile > .pylintrc` in my Windows 11 cmd. – Cees Timmerman Oct 24 '22 at 16:11
4

Try setting PYLINTRC env variable.

I use batch:

@echo off
set PYLINTHOME=c:\tools
set PYLINTRC=c:\etc\pylint.conf
rem c:\Python27\python.exe c:\Python27\Lib\site-packages\pylint\lint.py %1 %2 %3 %4 %5 %6 %7 %8 %9
c:\Python27\python.exe c:\Python27\Lib\site-packages\pylint\lint.py %*
Michał Niklas
  • 53,067
  • 18
  • 70
  • 114
  • 1
    fyi, instead of %1 through %9, it's simpler to just use %* which means "and all the rest". See http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file – twasbrillig Feb 18 '15 at 01:33