← Back to team overview

lazr-developers team mailing list archive

[Merge] lp:~gary/lazr.yourpkg/linters into lp:lazr.yourpkg

 

Gary Poster has proposed merging lp:~gary/lazr.yourpkg/linters into lp:lazr.yourpkg.

Requested reviews:
    Francis J. Lacoste (flacoste)
    LAZR Developers (lazr-developers)

This adds pylint and pyflakes to the lazr.yourpkg template buildout.

Even though our systems have pylint installed, this specifies a different version, because, in order to work on other operating systems, we need to rely on a package that works with a specific version of pylint.

To try this out, check out the branch, and then, in the branch's top directory, run ``python2.4 bootstrap.py`` and ``./bin/buildout.py``.  You will then see a lot of complaints because the pylint code is being run and python2.4 doesn't like the tests, it seems.  I do not know of a quick way to make this prettier or faster.  After ``./bin/buildout`` has run to completion, you can then use ``./bin/pylint`` and ``./bin/pyflakes [files]``.

This branch also has changes to make pylint give the package a 10/10 (up from -6 initially).

I'm interested to see if this is regarded as a valuable addition. :-)

Gary
-- 
https://code.launchpad.net/~gary/lazr.yourpkg/linters/+merge/4808
Your team LAZR Developers is subscribed to branch lp:lazr.yourpkg.
=== modified file 'buildout.cfg'
--- buildout.cfg	2009-03-17 14:52:16 +0000
+++ buildout.cfg	2009-03-23 20:25:41 +0000
@@ -4,6 +4,8 @@
     test
     docs
     tags
+    pylint
+    pyflakes
 unzip = true
 
 develop = .
@@ -29,3 +31,24 @@
 [tags]
 recipe = z3c.recipe.tag:tags
 eggs = lazr.yourpkg
+
+[pylint]
+recipe = zc.recipe.egg
+scripts = pylint
+eggs =
+    setuptools
+    pylint==0.15.2
+    lazr.yourpkg
+    logilab.pylintinstaller==0.15.2
+entry-points = pylint=pylint.lint:Run
+arguments = ['lazr.yourpkg'] + sys.argv[1:]
+
+[pyflakes]
+recipe = zc.recipe.egg
+scripts = pyflakes
+eggs =
+    setuptools
+    pyflakes
+    lazr.yourpkg
+entry-points = pyflakes=pkg_resources:run_script
+arguments = 'pyflakes', 'pyflakes'

=== modified file 'src/lazr/yourpkg/docs/__init__.py'
--- src/lazr/yourpkg/docs/__init__.py	2009-01-09 02:10:26 +0000
+++ src/lazr/yourpkg/docs/__init__.py	2009-03-23 20:08:39 +0000
@@ -0,0 +1,16 @@
+# Copyright 2009 Canonical Ltd.  All rights reserved.
+#
+# This file is part of lazr.yourpkg
+#
+# lazr.yourpkg is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, version 3 of the License.
+#
+# lazr.yourpkg is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with lazr.yourpkg.  If not, see <http://www.gnu.org/licenses/>.
+"""Executable documentation about lazr.yourpkg."""

=== modified file 'src/lazr/yourpkg/tests/test_docs.py'
--- src/lazr/yourpkg/tests/test_docs.py	2009-03-20 17:47:23 +0000
+++ src/lazr/yourpkg/tests/test_docs.py	2009-03-23 20:08:39 +0000
@@ -15,6 +15,8 @@
 # along with lazr.yourpkg.  If not, see <http://www.gnu.org/licenses/>.
 "Test harness for doctests."
 
+# pylint: disable-msg=E0611,W0142
+
 __metaclass__ = type
 __all__ = [
     'additional_tests',
@@ -23,7 +25,8 @@
 import atexit
 import doctest
 import os
-import pkg_resources
+from pkg_resources import (
+    resource_filename, resource_exists, resource_listdir, cleanup_resources)
 import unittest
 
 DOCTEST_FLAGS = (
@@ -35,16 +38,14 @@
 def additional_tests():
     "Run the doc tests (README.txt and docs/*, if any exist)"
     doctest_files = [
-        os.path.abspath(
-            pkg_resources.resource_filename('lazr.yourpkg', 'README.txt'))]
-    if pkg_resources.resource_exists('lazr.yourpkg', 'docs'):
-        for name in pkg_resources.resource_listdir('lazr.yourpkg', 'docs'):
+        os.path.abspath(resource_filename('lazr.yourpkg', 'README.txt'))]
+    if resource_exists('lazr.yourpkg', 'docs'):
+        for name in resource_listdir('lazr.yourpkg', 'docs'):
             if name.endswith('.txt'):
                 doctest_files.append(
                     os.path.abspath(
-                        pkg_resources.resource_filename(
-                            'lazr.yourpkg', 'docs/%s' % name)))
+                        resource_filename('lazr.yourpkg', 'docs/%s' % name)))
     kwargs = dict(module_relative=False, optionflags=DOCTEST_FLAGS)
-    atexit.register(pkg_resources.cleanup_resources)
+    atexit.register(cleanup_resources)
     return unittest.TestSuite((
         doctest.DocFileSuite(*doctest_files, **kwargs)))