pylint

How to specify a configuration file for pylint under windows?

夙愿已清 提交于 2019-11-29 05:29:12
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

Disabling Pylint no member- E1101 error for specific libraries

心不动则不痛 提交于 2019-11-29 05:10:19
问题 Is there anyway to hide E1101 errors for objects that are created from a specific library? Our large repository is littered with #pylint: disable=E1101 around various objects created by pandas. For example, pylint will throw a no member error on the following code: import pandas.io.data import pandas as pd spy = pandas.io.data.DataReader("SPY", "yahoo") spy.to_csv("test.csv") spy = pd.read_csv("test.csv") close_px = spy.ix["2012":] Will have the following errors: E: 6,11: Instance of 'tuple'

Best practice for setting the default value of a parameter that's supposed to be a list in Python?

删除回忆录丶 提交于 2019-11-29 02:02:29
问题 I have a Python function that takes a list as a parameter. If I set the parameter's default value to an empty list like this: def func(items=[]): print items Pylint would tell me "Dangerous default value [] as argument". So I was wondering what is the best practice here? 回答1: Use None as a default value: def func(items=None): if items is None: items = [] print items The problem with a mutable default argument is that it will be shared between all invocations of the function -- see the

For Pylint, is it possible to have a different pylintrc file for each Eclipse project?

烂漫一生 提交于 2019-11-29 01:29:53
I saw I can change it per Eclipse instance using this solution. I would like to set it per project. Is it possible? sthenault This is not Eclipse specific, but it may help anyway. According to pylint command line options : You can specify a configuration file on the command line using the --rcfile option. Otherwise, Pylint searches for a configuration file in the following order and uses the first one it finds: pylintrc in the current working directory .pylintrc in the current working directory If the current working directory is in a Python module, Pylint searches up the hierarchy of Python

How do I get Pylint message IDs to show up after pylint-1.0.0?

十年热恋 提交于 2019-11-28 22:56:17
Starting with pylint-1.0.0 the --include-ids argument is no longer allowed. How do I get: ************* Module foo.bar E:199,11: Module 'yaml' has no 'scanner' member (no-member) ************* Module foo.baz W:153,27: Unused variable '_filenames' (unused-variable) to show the IDs (e.g. W0142), for each warning? The new way to specify this is the command line parameter '--msg-template={path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' . 来源: https://stackoverflow.com/questions/18133264/how-do-i-get-pylint-message-ids-to-show-up-after-pylint-1-0-0

How to fix pylint logging-not-lazy? [duplicate]

我的未来我决定 提交于 2019-11-28 21:00:01
This question already has an answer here: PyLint message: logging-format-interpolation 1 answer I am using prospector to examine my code. Pylint returned a logging-not-lazy warning about my debug message. Line: 31 pylint: logging-not-lazy / Specify string format arguments as logging function parameters (col 16) Line: 42 pylint: logging-not-lazy / Specify string format arguments as logging function parameters (col 12) My code is: logging.debug("detect mimetypes faild because %s" % e ) How do I fix logging-not-lazy in pylint? Zada Zorg This mean, that you should rewrite your code as: logging

How to configure PyLint to check all things PEP8 checks?

痴心易碎 提交于 2019-11-28 20:14:13
Searching for an answer on PyLint's mailing list brings no interesting results. PyLint is known to be very customizable so I guess this should be possible... The reason I would like PyLint to check compliance with PEP8 is because PyDev has much better support for PyLint than it has for PEP8. It's easier to have one tool doing all checks than having to use two. I also asked this question on PyLint's mailing list at http://thread.gmane.org/gmane.comp.python.logilab/1039 Example of diagnostic messages from PEP8 which I don't get from PyLint: E203 whitespace before ':' E225 missing whitespace

How do I tell PyLint “it's a variable, not a constant” to stop message C0103?

梦想的初衷 提交于 2019-11-28 18:31:19
I have a module-level variable in my Python 2.6 program named "_log", which PyLint complains about: C0103: Invalid name "_log" (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) Having read this answer I understand why it's doing this: it thinks the variable is a constant and applies the constant regex. However, I beg to differ: I think it's a variable. How do I tell PyLint that, so it doesn't complain? How does PyLint determine whether it's a variable or a constant - does it just treat all module-level variables as constants? ChristopheD # pylint: disable-msg=C0103 Put it in the scope where you

Pylint disable all warnings for a file

▼魔方 西西 提交于 2019-11-28 18:30:59
We are using pylint within our build system. We have a python package within our code base that has throwaway code, and I'd like to disable all warnings for a module temporarily so I can stop bugging the other devs with these superfluous messages. Is there an easy way to pylint: disable all warnings for a module? enderskill From the PyLint FAQ With Pylint < 0.25, add # pylint: disable-all at the beginning of the module. Pylint 0.26.1 and up have renamed that directive to # pylint: skip-file (but the first version will be kept for backward compatibility). In order to ease finding which modules

Finding dead code in large python project [closed]

雨燕双飞 提交于 2019-11-28 18:12:41
问题 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