pylint

Setting up Pylint with PyDev

被刻印的时光 ゝ 提交于 2019-11-30 01:41:49
I have installed pylint via easy_install. I can run pylint <filename> with success. But pydev refuses to use it. I checked "use pylint" I configured correct path I updated my python interpreter in eclipse to have pylit in pythonpath I use Eclipse Galileo I have build automatically checked I tried cleaning whole project and no errors What am I doing wrong? ariddell I'm guessing you may need to mark the folder that contains your code as a source folder . You can do this under project properties. Project->Properties->PyDev-PYTHONPATH add relevant folders to the list of sources. I've noticed that

Finding dead code in large python project [closed]

安稳与你 提交于 2019-11-29 22:37:29
I've seen How can you find unused functions in Python code? but that's really old, and doesn't really answer my question. I have a large python project with multiple libraries that are shared by multiple entry point scripts. This project has been accreting for many years with many authors, so there's a whole lot of dead code. You know the drill. I know that finding all dead code is un-decidable. All I need is a tool that will find all functions that are not called anywhere. We're not doing anything fancy with calling functions based on the string of the function name, so I'm not worried about

Python: avoiding pylint warnings about too many arguments

眉间皱痕 提交于 2019-11-29 21:01:11
I want to refactor a big Python function into smaller ones. For example, consider this following code snippet: x = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 Of course, this is a trivial example. In practice, the code is more complex. My point is that it contains many local-scope variables that would have to be passed to the extracted function, which could look like: def mysum(x1, x2, x3, x4, x5, x6, x7, x8, x9): x = x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 return x The problem is that pylint would trigger a warning about too many arguments. I could avoid the warning by doing something like:

How to run Pylint with PyCharm

时间秒杀一切 提交于 2019-11-29 20:14:48
I want to configure pylint as an external tool on my entire project directory for a python project that I'm working on. I've tried to use the repository as a module with __init__.py and without, and its not working either way. I'm having difficulty setting up pylint to run with PyCharm. I know that I should be running it as an external tool, however the settings confuse me. The authoritative source on their documentation is broken, so I can't check that up either. lmiguelvargasf You can set up pylint to work with PyCharm by following the next steps: Install pylint : $ pip install pylint Locate

Imports failing in VScode for pylint when importing pygame

早过忘川 提交于 2019-11-29 17:29:17
When importing pygame pylint is going crazy: E1101:Module 'pygame' has no 'init' member E1101:Module 'pygame' has no 'QUIT' member I have searched the net and I have found this: "python.linting.pylintArgs": ["--ignored-modules=pygame"] It solves the problem with pygame, but now pylint is going crazy in other way: crazy_pylint.png . Then I have found "python.linting.pylintArgs": ["--ignored-files=pygame"] , but what it does is completely disabling pylint for the whole directory I am working in. So how do I say pylint that everything is OK with pygame? For E1101 : The problem is that most of

No name 'QApplication' in module 'PyQt5.QtWidgets' error in Pylint

本秂侑毒 提交于 2019-11-29 15:44:57
问题 Running into this issue in VS Code while trying to learn PyQt5, "No name 'QApplication' in module 'PyQt5.QtWidgets'", "No name 'QWidget' in module 'PyQt5.QtWidgets'"". I'm not sure if this is a pylint issue or something else. I've confirmed PyQt5 is installed with pip3 list but I can't seem to figure out the issue. import sys from PyQt5.QtWidgets import QApplication, QWidget def app(): my_app = QApplication(sys.argv) w = QWidget() w.setWindowTitle("Test") w.show() sys.exit(my_app.exec_()) app

pylint ignore by directory

让人想犯罪 __ 提交于 2019-11-29 13:07:26
Following is from pylint docs : --ignore=<file> Add <file or directory> to the black list. It should be a base name, not a path. You may set this option multiple times. [current: %default] Yet I'm not having luck getting the directory part work. I have directory called migrations, which has django-south migration files. As I enter --ignore=migrations it still keeps giving me the errors/warnings in files inside migrations directory. Could it be that --ignore is not working for directories? If I could even use regexp to match the ignored files it would work, since django-south files are all

How to disable pylint 'Undefined variable' error for a specific variable in a file?

牧云@^-^@ 提交于 2019-11-29 12:03:46
问题 I am hosting IronPython inside a C# application and injecting an API for the host into the global scope. I have just started to love syntastic for vim with pylint for checking my scripts. But I am getting annoyed by all the [E0602, method_name] Undefined variable 'variable_name' error messages for the injected variables. I am aware of using # pylint: disable=E0602 to disable this error message, but I'd prefer not to cripple a really useful feature just for some specific variable names. How do

Unintentional trailing comma that creates a tuple

好久不见. 提交于 2019-11-29 10:05:33
In Python, leaving a trailing comma like this is, of course, not a SyntaxError : In [1]: x = 1 , In [2]: x Out[2]: (1,) In [3]: type(x) Out[3]: tuple But, at the same time, if the trailing comma was put accidentally , it may be difficult to catch this kind of a "problem", especially for Python newcomers. I am thinking if we can catch this kind of a "problem" early , statically, with the help of PyCharm smart code quality control features; mypy , pylint or flake8 static code analysis tools. Or, another idea would be to restrict/highlight creating one item tuples implicitly without parenthesis .

Using Pylint to display error and warnings

自古美人都是妖i 提交于 2019-11-29 09:33:18
问题 So I started using Pylint but since I am using tabs instead of spaces it is giving me as warnings, also since some methods are from base class, that are also as instance of 'GalleryUi' has no 'setModel' member while it is has QAbstractTableModel as base class, so how do i set up the Pylint to not consider these things... No config file found, using default configuration ************* Module python.gallery W: 7, 0: Found indentation with tabs instead of spaces (mixed-indentation) W: 8, 0: