pylint

Visual Studio Code, pylint complaining about “Unable to import XXX”

强颜欢笑 提交于 2019-12-06 07:48:48
I am using Visual Studio Code to work on a large python project with many modules. My settings.json looks like this: { "python.linting.pylintEnabled": true, "python.linting.enabled": true, "python.autoComplete.extraPaths": [ "C:/Users/.../repos/platform", ], "python.linting.pylintPath": "pylint" } After that inside the code. I am getting a ton of error on all import modules which are inside the platform-folder. I have python3 installed with python extensions and pylint installed as well. I have searched for over an another and tried many different suggestions but none has worked for me so far.

No luck pip-installing pylint for Python 3

爷,独闯天下 提交于 2019-12-06 00:54:28
问题 I'm interested in running a checker over my Python 3 code to point out possible flaws. PyChecker does not work with Python 3. I tried to pip-install Pylint, but this fails. The error message does not help me (see paste). Pylint's Readme states that: Pylint should be compatible with any python >= 2.2. However, the page somehow feels outdated. Is pylint compatible with Python 3? If yes, how can I install it? If no, are there alternatives I should look into? 回答1: Yes, pylint versions > 0.23.0 do

VS Code PyLint Error E0602 (undefined variable) with ProtoBuf compiled Python Structure

北战南征 提交于 2019-12-05 19:11:28
I was using Visual Studio for a long time, but it was becoming too complicated to maintain. Now I tried to move to VS Code, but it throws a number of PyLint error messages that don't make sense to me (and the program still works as expected). These errors happen primarily with Python code generated from a GoogleProtoBuf structure. For example: from lbsnstructure.lbsnstructure_pb2 import lbsnPost def geoaccuracy_within_threshold(post_geoaccuracy, min_geoaccuracy): """Checks if geoaccuracy is within or below threshhold defined""" if min_geoaccuracy == lbsnPost.LATLNG: allowed_geoaccuracies =

python code convention using pylint

半世苍凉 提交于 2019-12-05 17:06:15
问题 I'm trying out pylint to check my source code for conventions. Somehow some variable names are matched with the regex for constants ( const-rgx ) instead of the variable name regex ( variable-rgx ). How to match the variable name with variable-rgx ? Or should I extend const-rgx with my variable-rgx stuff? e.g. C0103: 31: Invalid name "settings" (should match (([A-Z_][A-Z1-9_]*)|(__.*__))$) 回答1: Somehow some variable names are matched with the regex for constants (const-rgx) instead of the

How to get pylint warnings to be marked in the Pydev Eclipse editor margin?

*爱你&永不变心* 提交于 2019-12-05 16:36:54
问题 I have pylint installed (works fine on the command line) and set up within Pydev in Eclipse. Pylint is being triggered OK when I edit files, and is outputting to the Eclipse console. But, the pylint warnings don't appear as marks in the editor margin (in the same way as compiler warnings and errors) Newly-generated warnings don't appear in the Problems view either - there are some old ones showing, but they disappear if I re-save the relevant module. I know this is possible as I've had it

Unneeded parts when unwrapping tuple/list

*爱你&永不变心* 提交于 2019-12-05 14:30:01
Python is all about writing beautiful code. So, I was running pylint to check the "beautifulness" of my code, when I bump into something: Unused variable 'myvar1' From this part of my code: for myvar1, myvar2 in mylist: # Do stuff just using myvar2 mylist is a list of tuples, so I'm unwrapping the tuples into two variables ( myvar1 and myvar2 ). I'm defining those two variables just to unwrap the second one, because I don't need the other. So, here's my question: Is there a way to tell the interpreter to unwrap the tuple, but not assing the first part (for example). In some other languages you

Using Pylint in Ipython (Jupyter-Notebook)

狂风中的少年 提交于 2019-12-05 12:58:56
问题 I want to run Pylint or any equivalent while using Jupyter-Notebook. Is there a way to install and run Pylint this way? 回答1: pycodestyle is an equivalent of pylint for Jupyter Notebook which is able to check your code against the PEP8 style guide. First, you need to install the pycodestyle in jupyter notebook by typing this command, !pip install pycodestyle pycodestyle_magic Run this command in a cell of jupyter notebook. After successful installation, you have to load the magic in a Jupyter

How would I start integrating pyflakes with Hudson

守給你的承諾、 提交于 2019-12-05 04:39:56
We use Hudson for continuous integration with the Violations Plugin which parses our output from pylint. However, pylint is a bit too strict, and hard to configure. What we'd rather use is pyflakes which would give us the right level of "You're doing it wrong." You can adapt pyflakes and pep8 output to work with the Violations pylint plugin. pyflakes path/to/src | awk -F\: '{printf "%s:%s: [E]%s\n", $1, $2, $3}' > violations.pyflakes.txt pep8 path/to/src | awk -F\: '{printf "%s:%s: [%s]%s\n", $1, $2, substr($4,2,4), substr($4,6)}' > violations.pep8.txt You could use a regex or concatenate the

Jenkins with pylint gives build failure

守給你的承諾、 提交于 2019-12-05 02:37:14
I added a build step to execute a Python script. In this script pylint is called with the lint.Run(..args) to check the code. The script works but in the end, the build fails with the only error message: Build step 'Execute Python script' marked build as failure Someone has an idea why this happens? it seems that your pylint execution exit with a non-zero status (missing script, bad options...), maybe you exit the script with an exception raised or a sys.exit(something_else_than_zero) You can also simply put a pylint || exit 0 in the shell cmdline. The Pylint plugin will fail the build anyway

Adding a path to sys.path in python and pylint

江枫思渺然 提交于 2019-12-05 02:28:30
So. I'm aware that this question seems to have been asked to death, but none of the answers seem to address what I want to do. I have a library in another directory that I want to include in a set of other projects that I run. I don't want that library added every time I run python.. So, what I had been doing was this in my python code: import sys sys.path.append("/tmp/demo/src/my-lib") import MyClass and this worked fine. But, now that I've discovered and love pylint, it complains that E: 7, 0: Unable to import 'MyClass' (import-error) C: 7, 0: Import "import MyClass" should be placed at the