diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-04-17 10:59:21 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2013-04-17 10:59:21 +0200 |
commit | f6c025f87039b7081544affda2776773df80f8cb (patch) | |
tree | e508d3492714d2e6a31801410386a1761f4d1326 /doc | |
parent | 4a368bbc1c26254fb688966b1cda28471a57eb8c (diff) | |
download | pylint-f6c025f87039b7081544affda2776773df80f8cb.tar.gz |
[doc/faq] refer to existing section of the documentation in the faq, reorder message control section
Diffstat (limited to 'doc')
-rw-r--r-- | doc/faq.rst | 182 |
1 files changed, 54 insertions, 128 deletions
diff --git a/doc/faq.rst b/doc/faq.rst index dbe8aae..5e0afbc 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -35,52 +35,19 @@ file. .. _Logilab: http://www.logilab.fr/ -1.4 Who uses Pylint? --------------------- - -In addition to many individuals, the following projects are known to use Pylint -to help develop write better code: - -* OSAF Chandler (http://www.osafoundation.org/) -* Xen (http://www.xensource.com/) -* CPS (http://www.nuxeo.org) -* ERP5 (http://www.erp5.org/) -* pyxmpp (http://pyxmpp.jabberstudio.org/) -* mercurial -* eXe (http://exelearning.org/) -* PrimaGIS (http://www.primagis.org) -* python-cdd (http://projetos.ossystems.com.br/python-cdd/) -* CDSWare (http://cdsware.cern.ch/) -* ASE (http://dcwww.camp.dtu.dk/campos/ASE/intro.html) -* RunJob (http://projects.fnal.gov/runjob/) -* Slugathon (http://slugathon.python-hosting.com/) -* Topographica (http://topographica.org/Home/index.html) (at least - they intend to do so) -* http://browsershots.org - - 2. Installation =============== 2.1 How do I install Pylint? ---------------------------- -The easiest way to install Pylint, if you have the setuptools_ package, is to -invoke :: - - easy_install pylint - -Otherwise, you'll have to download the source for Pylint and its dependencies -from the Logilab site, or through Pylint's repository. See the user manual for -detailed installation instructions. - -.. _setuptools: http://pypi.python.org/pypi/setuptools +Everything should be explained on http://docs.pylint.org/installation.html 2.2 What kind of versioning system does Pylint use? --------------------------------------------------- Pylint uses the Mercurial_ distributed version control system. The URL of the -repository is: https://bitbucket.org/logilab/pylint. To get the latest version of +repository is https://bitbucket.org/logilab/pylint. To get the latest version of Pylint from the repository, simply invoke :: hg clone https://bitbucket.org/logilab/pylint @@ -91,7 +58,7 @@ Pylint from the repository, simply invoke :: ----------------------------------- Pylint requires the latest `astng`_ and `logilab-common`_ packages. It should be -compatible with any python version greater than 2.5.0. +compatible with any Python version greater than 2.5.0. .. _`astng`: https://bitbucket.org/logilab/astng .. _`logilab-common`: http://www.logilab.org/project/logilab-common @@ -100,8 +67,8 @@ compatible with any python version greater than 2.5.0. 3. Running Pylint ================= -3.1 Can I give pylint a file as an argument instead of a module? ------------------------------------------------------------------ +3.1 Can I give pylint a file as argument instead of a module? +------------------------------------------------------------- Pylint expects the name of a package or module as its argument. As a convenience, @@ -154,30 +121,8 @@ For example:: 3.4 I'd rather not run Pylint from the command line. Can I integrate it with my editor? --------------------------------------------------------------------------------------- -Yes! Pylint can be integrated with many popular editors and IDEs. The following -include Pylint by default: - -* emacs (of course) -* eric3 -* eclipse (using the pydev_ plugin, see also - http://msdl.cs.mcgill.ca/MSDL/people/denis/meetings/pythonDev) - -To use pylint from within vim, see -http://www.gonzo.kiev.ua/projects/pylint.vim - -To use pylint from within komodo_, see -http://mateusz.loskot.net/2006/01/15/running-pylint-from-komodo/ - -To use pylint from within gedit_, see -http://live.gnome.org/Gedit/PylintPlugin - -To use pylint from within WingIDE_, see -http://www.wingware.com/doc/edit/pylint +Much probably. Read http://docs.pylint.org/ide-integration.html -.. _pydev: http://pydev.sourceforge.net -.. _komodo: http://www.activestate.com/Products/Komodo/ -.. _gedit: http://www.gnome.org/projects/gedit/ -.. _WingIDE: http://www.wingware.com/ 4. Message Control ================== @@ -189,30 +134,38 @@ Yes, this feature has been added in pylint 0.11. This may be done by adding "#pylint: disable=W0123,E4567" at the desired block level or at the end of the desired line of code +4.2 Is there a way to disable or to enable a message for a particular module only? +---------------------------------------------------------------------------------- -4.2 Why do I get a lot of spurious "unused variables messages" when using psyobj from psyco_? ----------------------------------------------------------------------------------------------- +Yes, you can disable or enable (otherwise globally disabled) messages at the +module level by adding the corresponding option in a comment at the +top of the file: :: -This is actually due to a bug in psyco, making the locals() -function for objects inheriting from *psyobj* returning an empty -dictionary. For the moment, the only way to fix this is to use the -PYLINT_IMPORT environment variable to not use psyco during Pylint -checking. Sample code :: + # pylint: disable=W0401, E0202 + # pylint: enable=C0302 - import os - try: - if os.environ.has_key('PYLINT_IMPORT'): - raise ImportError() - from psyco.classes import psyobj - except ImportError: - class psyobj: - pass -NOTICE: this problem should not occur with Pylint >= 0.5 since from -this version Pylint is not looking anymore for information in living -objects (i.e. it no longer imports analysed modules) +4.3 How can I tell Pylint to never check a given module? +-------------------------------------------------------- + +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 are ignored a Information-level +message I0013 is emited. With recent versions of Pylint, if you use +the old syntax, an additional I0014 message is emited. + +4.4 Do I have to remember all these numbers? +-------------------------------------------- + +No, starting from 0.25.3, you can use symbolic names for messages:: + + # pylint: disable=fixme, line-too-long + +You can show these symbols in the output with the `-sy` option. -.. _psyco: http://psyco.sf.net 4.3 I have a callback function where I have no control over received arguments. How do I avoid getting unused argument warnings? ---------------------------------------------------------------------------------------------------------------------------------- @@ -222,16 +175,6 @@ doing so arguments usage won't be checked. Another solution is to use one of the names defined in the "dummy-variables" configuration variable for unused argument ("_" and "dummy" by default). -4.4 Is there a way to disable a message for a particular module only? ---------------------------------------------------------------------- - -Yes, you can disable or enable (globally disabled) messages at the -module level by adding the corresponding option in a comment at the -top of the file: :: - - # pylint: disable=W0401, E0202 - # pylint: enable=C0302 - 4.5 What is the format of the configuration file? --------------------------------------------------- @@ -242,26 +185,30 @@ It means that if you need to disable a lot of messages, you can use tricks like: E0202, # I have a good reason, trust me C0302 # that's it -4.6 Do I have to remember all these numbers? --------------------------------------------- -No, starting from 0.25.3, you can use symbolic names for messages:: - - # pylint: disable=fixme, line-too-long +4.2 Why do I get a lot of spurious "unused variables messages" when using psyobj from psyco_? +---------------------------------------------------------------------------------------------- -You can show these symbols in the output with the `-sy` option. +This is actually due to a bug in psyco, making the locals() +function for objects inheriting from *psyobj* returning an empty +dictionary. For the moment, the only way to fix this is to use the +PYLINT_IMPORT environment variable to not use psyco during Pylint +checking. Sample code :: -4.7 How can I tell Pylint to never check a given module? --------------------------------------------------------- + import os + try: + if os.environ.has_key('PYLINT_IMPORT'): + raise ImportError() + from psyco.classes import psyobj + except ImportError: + class psyobj: + pass -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). +NOTICE: this problem should not occur with Pylint >= 0.5 since from +this version Pylint is not looking anymore for information in living +objects (i.e. it no longer imports analysed modules) -In order to ease finding which modules are ignored a Information-level -message I0013 is emited. With recent versions of Pylint, if you use -the old syntax, an additional I0014 message is emited. +.. _psyco: http://psyco.sf.net @@ -323,32 +270,11 @@ traverses an AST representation of the code. 6.3 I think I found a bug in Pylint. What should I do? ------------------------------------------------------- - -First, you might wish to check Pylint's ticketing system (the 'Issues' tab at -https://bitbucket.org/logilab/pylint), to make sure it hasn't been reported -already. If it hasn't, please create a new issue there. +Read http://docs.pylint.org/contribute.html#bug-reports-feedback 6.4 I have a question about Pylint that isn't answered here. ------------------------------------------------------------ -The python-projects@logilab.org mailing list is a great place to discuss and -ask questions about Pylint. This is a -moderated mailing list, so if you're not subscribed email you send will have to -be validated first before actually being sent on the list. - -You can subscribe to this mailing list at -http://lists.logilab.org/mailman/listinfo/python-projects - -Archives are available at -http://lists.logilab.org/pipermail/python-projects/ - -If you prefer speaking french instead of english, you can use the -generic forum-fr@logilab.org mailing list: - -* (un)subscribe: http://lists.logilab.org/mailman/listinfo/forum-fr -* archives: http://lists.logilab.org/pipermail/forum-fr - -Notice though that this list has a very low traffic since most Pylint related -discussions are done on the python-projects mailing list. +Read http://docs.pylint.org/contribute.html#mailing-lists .. _pychecker: http://pychecker.sf.net |