obriencj/python-javatools

pylint fails

Closed this issue · 7 comments

$ python setup.py pylint
running pylint
running build
running build_py
copying javatools/manifest.py -> build/lib.linux-x86_64-2.7/javatools
error: could not delete 'build/lib.linux-x86_64-2.7/javatools/manifest.py': Permission denied

I'm not (yet) familiar with pylint; I'd expect that the user does not need to install anything in order to run the report, but anyway:

$ sudo python setup.py pylint
[sudo] password for konstantin: 
running pylint
running build
running build_py
copying javatools/manifest.py -> build/lib.linux-x86_64-2.7/javatools
running build_scripts
Traceback (most recent call last):
  File "setup.py", line 78, in <module>
    'pylint': pylint_cmd } )
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/konstantin/python-javatools/extras/pylint_cmd.py", line 143, in run
    self.run_linter()
  File "/home/konstantin/python-javatools/extras/pylint_cmd.py", line 107, in run_linter
    linter.disable('suppressed-message')
  File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 192, in disable
    msg = self.check_message_id(msgid)
  File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 256, in check_message_id
    raise UnknownMessage('No such message id %s' % msgid)
pylint.utils.UnknownMessage: No such message id SUPPRESSED-MESSAGE

That first run is likely due to you having run a previous invocation of "sudo python setup.py build" so now your build dir has subdirectories owned by root rather than your user.

The second one... well, that's pylint for you. I'll look to see if there's an alternative configuration I could use that will work. What version of pylint do you have installed?

Pylint is frustrating to configure at times, but can be invaluable for detecting errors in your code before you actually encounter them at run time. It will find syntax issues, method/function invocation signature mismatches, unknown variables, unused variables, etc.

I made a tweak, it may work for you now. You may want to run sudo ./setup.py clean once, or just remove the build directory. After that you should be able to run ./setup.py build without any more permissions problems.

Thank you for the explanations and sorry for taking your time with them!
After the update, pylint still complains:

$ ./setup.py pylint
running pylint
running build
running build_py
copying javatools/manifest.py -> build/lib.linux-x86_64-2.7/javatools
running build_scripts
Traceback (most recent call last):
  File "./setup.py", line 78, in <module>
    'pylint': pylint_cmd } )
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/home/konstantin/Storage/Signed-SW/python-javatools/extras/pylint_cmd.py", line 143, in run
    self.run_linter()
  File "/home/konstantin/Storage/Signed-SW/python-javatools/extras/pylint_cmd.py", line 103, in run_linter
    linter.load_config_file()
  File "/usr/lib/python2.7/dist-packages/logilab/common/configuration.py", line 649, in load_config_file
    provider.set_option(option, value, optdict=optdict)
  File "/usr/lib/python2.7/dist-packages/pylint/lint.py", line 341, in set_option
    meth(_id)
  File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 192, in disable
    msg = self.check_message_id(msgid)
  File "/usr/lib/python2.7/dist-packages/pylint/utils.py", line 256, in check_message_id
    raise UnknownMessage('No such message id %s' % msgid)
pylint.utils.UnknownMessage: No such message id I0020

My version is:

$ pylint --version
No config file found, using default configuration
pylint 0.26.0, 
astng 0.24.1, common 0.59.1
Python 2.7.5+ (default, Feb 27 2014, 19:37:08) 
[GCC 4.8.1]

Oh wow, that's a really really old version of pylint. Is there a later version available via whatever package manager you use? Or pip should have something more modern. Current version of pylint is 1.3.1, but most distributions carry 1.2.0

I shut down all Info-level checks in the pylintrc... at least I hope the older versions support doing that. Would you give it a shot and see if it behaves now?

Upgraded pylint to v1.3.1 - thanks for the hint!
The modified version (by 2888ec2) worked even for the ancient pylint (provided in Ubuntu 14.04 LTS). Naturally, works with the newer version as well.

Okay, since it works now, I'll resolve this particular issue.