13

I'm using Sublime Text editor with Pylint as a Python code parser. It works fine, BUT whenever I define a variable, I receive the following error message (C0103):

Error: invalid constant name.

I read in this topic that one solution could be adding a # pylint: disable-msg=C0103 to the source code, but this solution isn't enough for me because I have a lot of variable definitions and I don't want to polute my code with calls to Pylint. I need to disable error message C0103 for good, globally, in ALL my Python's source files. I must get rid of this message forever. How can I accomplish this?

Community
  • 1
  • 1
renatov
  • 5,005
  • 6
  • 31
  • 38
  • This is a Sublime Text question, not a Python question. Python does not automatically do anything with pylint - this is a function of the editor or IDE. Most decent editors/IDEs will provide a settings panel which will allow you to disable specific errors (i.e. with PyCharm, this is in Settings->Inspections). I've retitled/retagged your question to help you get more relevant answers. – kitti Apr 21 '14 at 17:28
  • Maybe I wasn't clear, I don't want to disable this error only on Sublime, I want to disable it for good, in every text editor, in terminal calls, in whatever way Pylint is called. I temporarily already managed to disable it in Sublime by going to "Preferences > Package Settings > Sublime Linter > Settings - User" and adding `"disable": "C0103"` to pylint block. And I already managed to get rid of this message on terminal by adding `alias pylint="/usr/bin/pylint --disable=C0103"` to bashrc, but I'm not satisfied with these workarounds. I want to get rid of this error message for good, forever. – renatov Apr 21 '14 at 17:35
  • 1
    Ah, ok. Creating a `pylintrc` in the `site-packages` folder probably won't work. You would need to tell pylint to use this file every time the command is called (i.e. `--rcfile .../pylint.rc`). Have you tried creating this file as `~/.pylintrc` instead? I would imagine any invocation of pylint (as your user) would read that file. – kitti Apr 21 '14 at 17:43
  • Oh, that solved it! `cp /usr/lib/python2.7/site-packages/pylint/pylint.rc ~/.pylintrc`. Put this comment in the format of an answer, so I can set it as the correct answer to my question, please. Thank you (: – renatov Apr 21 '14 at 17:56

3 Answers3

17
pylint --generate-rcfile > ~/.pylintrc

Then add "disable": "C0103" to this file.

renatov
  • 5,005
  • 6
  • 31
  • 38
6

In order for pylint to automatically pick up your rc file, it should be located at ~/.pylintrc. Otherwise you would need to pass the rc file as an argument on every invocation of pylint.

kitti
  • 14,663
  • 31
  • 49
4

Alternative add disable=C0103 to .pylintrc this will ignore for the current directory or workspace.

bquarks
  • 37
  • 3