launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #05249
[Merge] lp:~jtv/launchpad/megalint-3 into lp:launchpad
Jeroen T. Vermeulen has proposed merging lp:~jtv/launchpad/megalint-3 into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~jtv/launchpad/megalint-3/+merge/79488
= Summary =
Clean up lint in some files we touched recently. It's getting to be less, so maybe our “working set” of code is reasonably clean now!
= Launchpad lint =
Some lint I had to leave in place: I was conservative in changing the license file; I didn't mess with cron.germinate too much since it's old and probably not very well-tested; and the _pythonpath warning is just a standing nuisance.
Checking for conflicts and issues in changed files.
Linting changed files:
lib/lp/app/browser/tests/test_mixed_visibility.py
lib/canonical/launchpad/webapp/authorization.py
LICENSE
lib/lp/registry/stories/person/xx-deactivate-account.txt
lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt
lib/lp/archivepublisher/tests/test_publisher.py
cronscripts/publishing/cron.germinate
database/replication/generate_migration.py
lib/canonical/librarian/smoketest.py
lib/lp/testing/tests/test_login.py
lib/lp/app/widgets/doc/launchpad-radio-widget.txt
lib/lp/registry/browser/productseries.py
./LICENSE
658: Line exceeds 78 characters.
./cronscripts/publishing/cron.germinate
32: Line exceeds 78 characters.
38: Line exceeds 78 characters.
60: Line exceeds 78 characters.
65: Line exceeds 78 characters.
66: Line exceeds 78 characters.
93: Line exceeds 78 characters.
117: Line exceeds 78 characters.
122: Line exceeds 78 characters.
130: Line exceeds 78 characters.
136: Line exceeds 78 characters.
./database/replication/generate_migration.py
17: '_pythonpath' imported but unused
--
https://code.launchpad.net/~jtv/launchpad/megalint-3/+merge/79488
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/launchpad/megalint-3 into lp:launchpad.
=== modified file 'LICENSE'
--- LICENSE 2011-10-13 01:57:01 +0000
+++ LICENSE 2011-10-16 08:24:25 +0000
@@ -15,7 +15,7 @@
Third-party copyright in this distribution is noted where applicable.
-All rights not expressly granted are reserved.
+All rights not expressly granted are reserved.
=========================================================================
=== modified file 'cronscripts/publishing/cron.germinate'
--- cronscripts/publishing/cron.germinate 2011-10-14 14:43:16 +0000
+++ cronscripts/publishing/cron.germinate 2011-10-16 08:24:25 +0000
@@ -1,6 +1,6 @@
#! /bin/sh
#
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
set -e
@@ -69,11 +69,13 @@
# copies for convenience
cp structure structure_"$distro"_"$suite"_"$arch"
- # Keep per distro/suite/arch copies of 'all' and 'all.sources' for anastacia
+ # Keep per distro/suite/arch copies of 'all' and 'all.sources' for
+ # anastacia.
cp all all_"$distro"_"$suite"_"$arch"
cp all.sources all.sources_"$distro"_"$suite"_"$arch"
- # Keep per distro/suite/arch copies of 'minimal' and 'standard' for jessica
+ # Keep per distro/suite/arch copies of 'minimal' and 'standard' for
+ # jessica.
cp minimal minimal_"$distro"_"$suite"_"$arch"
cp standard standard_"$distro"_"$suite"_"$arch"
@@ -139,15 +141,16 @@
echo -n "Running maintenance-check for $supported_suite... "
# The support timeframe information is stored here
SUPPORTED="$MISCROOT/more-extra.override.$supported_suite.main.supported"
- # This is the target override file that contains germinate plus support info
+ # This is the target override file that contains germinate plus
+ # support info.
TARGET="$MISCROOT/more-extra.override.$supported_suite.main"
- # Debug/Log information
+ # Debug/Log information
LOG="_maintenance-check.$supported_suite.stderr"
if $MAINTAINCE_CHECK $supported_suite > $SUPPORTED 2> $LOG; then
# The target file may be missing on the server and the script should
# not fail if that is the case.
touch $TARGET
- # Remove old "Supported" info from extra-overrides as it may be
+ # Remove old "Supported" info from extra-overrides as it may be
# stale now and we replace it with fresh content below.
sed /"^.* Supported"/d $TARGET > ${TARGET}.new
cat $SUPPORTED >> ${TARGET}.new
=== modified file 'database/replication/generate_migration.py'
--- database/replication/generate_migration.py 2011-10-13 03:52:48 +0000
+++ database/replication/generate_migration.py 2011-10-16 08:24:25 +0000
@@ -10,15 +10,11 @@
__metaclass__ = type
__all__ = []
-import _pythonpath
-
from optparse import OptionParser
import os.path
from textwrap import dedent
-from canonical.config import config
-from canonical.database.sqlbase import connect
-from canonical.launchpad import scripts
+import _pythonpath
import replication.helpers
from replication.helpers import (
LPMAIN_SET_ID,
@@ -28,6 +24,9 @@
get_master_node,
)
+from canonical.database.sqlbase import connect
+from canonical.launchpad import scripts
+
con = None
options = None
@@ -62,7 +61,7 @@
origin = result[0]
print >> outf, "define %s_origin %d;" % (set_name, origin)
else:
- del sets[set_id] # For testing. Production will have 3 sets.
+ del sets[set_id] # For testing. Production will have 3 sets.
outf.close()
@@ -118,7 +117,7 @@
node.node_id, first_node.node_id)
# Create paths so they can communicate.
- message(outf, "Storing %d paths" % pow(len(nodes),2))
+ message(outf, "Storing %d paths" % pow(len(nodes), 2))
for client_node in nodes:
for server_node in nodes:
print >> outf, (
@@ -158,7 +157,7 @@
message(outf, "Adding %d tables to %s" % (len(results), set_name))
for tab_id, tab_nspname, tab_relname, tab_comment in results:
if not tab_comment:
- tab_comment=''
+ tab_comment = ''
print >> outf, dedent("""\
set add table (
set id=@%s, origin=@%s_origin, id=%d,
@@ -175,7 +174,7 @@
message(outf, "Adding %d sequences to %s" % (len(results), set_name))
for seq_id, seq_nspname, seq_relname, seq_comment in results:
if not seq_comment:
- seq_comment=''
+ seq_comment = ''
print >> outf, dedent("""\
set add sequence (
set id=@%s, origin=@%s_origin, id=%d,
@@ -187,7 +186,6 @@
def generate_subscribe_set(set_id, set_name, outf):
- origin_node = get_master_node(con, set_id)
cur = con.cursor()
cur.execute("""
SELECT sub_receiver FROM _sl.sl_subscribe
=== modified file 'lib/canonical/launchpad/webapp/authorization.py'
--- lib/canonical/launchpad/webapp/authorization.py 2011-10-12 20:12:41 +0000
+++ lib/canonical/launchpad/webapp/authorization.py 2011-10-16 08:24:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
@@ -129,7 +129,7 @@
required by the permission, deny.
- If the object to authorize is private and the principal has no
access to private objects, deny.
- - If we have zope.Public, allow. (We shouldn't ever get this, though.)
+ - If we have zope.Public, allow. (But we shouldn't ever get this.)
- If we have launchpad.AnyPerson and the principal is an
ILaunchpadPrincipal then allow.
- If the object has an IAuthorization named adapter, named
=== modified file 'lib/canonical/librarian/smoketest.py'
--- lib/canonical/librarian/smoketest.py 2011-10-04 04:45:47 +0000
+++ lib/canonical/librarian/smoketest.py 2011-10-16 08:24:25 +0000
@@ -1,6 +1,6 @@
#! /usr/bin/python -S
#
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Perform simple librarian operations to verify the current configuration.
@@ -11,9 +11,9 @@
import sys
import urllib
-from zope.component import getUtility
import pytz
import transaction
+from zope.component import getUtility
from canonical.launchpad.interfaces.librarian import ILibraryFileAliasSet
@@ -24,9 +24,10 @@
def store_file(client):
+ expiry_date = datetime.datetime.now(pytz.UTC) + FILE_LIFETIME
file_id = client.addFile(
'smoke-test-file', FILE_SIZE, StringIO(FILE_DATA), 'text/plain',
- expires=datetime.datetime.now(pytz.UTC)+FILE_LIFETIME)
+ expires=expiry_date)
# To be able to retrieve the file, we must commit the current transaction.
transaction.commit()
alias = getUtility(ILibraryFileAliasSet)[file_id]
=== modified file 'lib/lp/app/browser/tests/test_mixed_visibility.py'
--- lib/lp/app/browser/tests/test_mixed_visibility.py 2011-10-13 05:27:16 +0000
+++ lib/lp/app/browser/tests/test_mixed_visibility.py 2011-10-16 08:24:25 +0000
@@ -24,7 +24,7 @@
# about a private team, with the feature flag enabled, an
# informational OOPS is logged.
team = self.factory.makeTeam(visibility=PersonVisibility.PRIVATE)
- viewer = self.factory.makePerson()
+ viewer = self.factory.makePerson()
with FeatureFixture(MIXED_VISIBILITY_FLAG):
with person_logged_in(viewer):
self.assertEqual(
=== modified file 'lib/lp/app/widgets/doc/launchpad-radio-widget.txt'
--- lib/lp/app/widgets/doc/launchpad-radio-widget.txt 2011-08-30 00:37:22 +0000
+++ lib/lp/app/widgets/doc/launchpad-radio-widget.txt 2011-10-16 08:24:25 +0000
@@ -1,4 +1,5 @@
-= LaunchpadRadioWidget =
+LaunchpadRadioWidget
+====================
There are two Launchpad radio widgets, one that shows descriptions,
and one that doesn't.
@@ -35,7 +36,8 @@
type="radio" value="REMOTE" /> Remote
-= LaunchpadRadioWidgetWithDescription =
+LaunchpadRadioWidgetWithDescription
+-----------------------------------
The LaunchpadRadioWidgetWithDescription widget renders the descriptions
along with the titles from the enumerated type vocabulary.
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2011-10-07 17:07:52 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2011-10-16 08:24:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
+# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for publisher class."""
@@ -17,7 +17,6 @@
from textwrap import dedent
from debian.deb822 import Release
-
import transaction
from zope.component import getUtility
from zope.security.proxy import removeSecurityProxy
@@ -26,7 +25,6 @@
from canonical.database.constants import UTC_NOW
from canonical.launchpad.ftests.keys_for_tests import gpgkeysdir
from canonical.launchpad.interfaces.gpghandler import IGPGHandler
-from lp.testing.keyserver import KeyServerTac
from lp.archivepublisher.config import getPubConfig
from lp.archivepublisher.diskpool import DiskPool
from lp.archivepublisher.interfaces.archivesigningkey import (
@@ -52,10 +50,9 @@
BinaryPackageFormat,
PackagePublishingStatus,
)
-from lp.soyuz.interfaces.archive import (
- IArchiveSet,
- )
+from lp.soyuz.interfaces.archive import IArchiveSet
from lp.soyuz.tests.test_publishing import TestNativePublishingBase
+from lp.testing.keyserver import KeyServerTac
RELEASE = PackagePublishingPocket.RELEASE
@@ -877,7 +874,8 @@
archive_publisher.D_writeReleaseFiles(False)
release = self.parseRelease(os.path.join(
- archive_publisher._config.distsroot, 'breezy-autotest', 'Release'))
+ archive_publisher._config.distsroot, 'breezy-autotest',
+ 'Release'))
self.assertEqual('LP-PPA-cprov', release['origin'])
# The Label: field should be set to the archive displayname
@@ -925,7 +923,8 @@
# Check the distinct Origin: field content in the main Release file
# and the component specific one.
release = self.parseRelease(os.path.join(
- archive_publisher._config.distsroot, 'breezy-autotest', 'Release'))
+ archive_publisher._config.distsroot, 'breezy-autotest',
+ 'Release'))
self.assertEqual('LP-PPA-cprov-testing', release['origin'])
arch_release = self.parseRelease(os.path.join(
=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt'
--- lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt 2011-09-29 05:41:31 +0000
+++ lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt 2011-10-16 08:24:25 +0000
@@ -1,4 +1,5 @@
-= Bug obfuscation =
+Bug obfuscation
+===============
Launchpad protects user email addresses from spam harvesters by
obfuscating addresses viewed by anonymous users. When a bug's
@@ -14,7 +15,8 @@
>>> user_browser.title
'Bug #3 in mozilla-firefox (Debian Sarge): ...Bug Title Test...'
- >>> description = find_tag_by_id(user_browser.contents, 'edit-description')
+ >>> description = find_tag_by_id(
+ ... user_browser.contents, 'edit-description')
>>> description.renderContents()
'...<p>Shirtpkdf user@xxxxxxxxxx lkjd hlkjfds...'
@@ -29,6 +31,7 @@
>>> 'user@xxxxxxxxxx' in anon_browser.contents
False
- >>> description = find_tag_by_id(anon_browser.contents, 'edit-description')
+ >>> description = find_tag_by_id(
+ ... anon_browser.contents, 'edit-description')
>>> description.renderContents()
'...<p>Shirtpkdf <email address hidden> lkjd hlkjfds...'
=== modified file 'lib/lp/registry/browser/productseries.py'
--- lib/lp/registry/browser/productseries.py 2011-10-11 12:01:13 +0000
+++ lib/lp/registry/browser/productseries.py 2011-10-16 08:24:25 +0000
@@ -100,10 +100,7 @@
StructuralSubscriptionMenuMixin,
StructuralSubscriptionTargetTraversalMixin,
)
-from lp.bugs.interfaces.bugtask import (
- BugTaskStatus,
- IBugTaskSet,
- )
+from lp.bugs.interfaces.bugtask import IBugTaskSet
from lp.code.browser.branch import BranchNameValidationMixin
from lp.code.browser.branchref import BranchRef
from lp.code.enums import (
=== modified file 'lib/lp/registry/stories/person/xx-deactivate-account.txt'
--- lib/lp/registry/stories/person/xx-deactivate-account.txt 2011-10-03 02:59:52 +0000
+++ lib/lp/registry/stories/person/xx-deactivate-account.txt 2011-10-16 08:24:25 +0000
@@ -1,4 +1,5 @@
-= Deactivating user accounts =
+Deactivating user accounts
+==========================
Users who don't want to use Launchpad anymore can easily deactivate their
accounts so they stop receiving emails from Launchpad and make it impossible
=== modified file 'lib/lp/testing/tests/test_login.py'
--- lib/lp/testing/tests/test_login.py 2011-10-05 21:33:43 +0000
+++ lib/lp/testing/tests/test_login.py 2011-10-16 08:24:25 +0000
@@ -1,4 +1,4 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2011 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for the login helpers."""
@@ -268,18 +268,22 @@
# with_celebrity_logged_in decorates a function so that it runs with
# the given person logged in.
vcs_imports = getUtility(ILaunchpadCelebrities).vcs_imports
+
@with_celebrity_logged_in('vcs_imports')
def f():
return self.getLoggedInPerson()
+
logout()
person = f()
self.assertTrue(person.inTeam, vcs_imports)
def test_with_person_logged_in(self):
person = self.factory.makePerson()
+
@with_person_logged_in(person)
def f():
return self.getLoggedInPerson()
+
logout()
logged_in = f()
self.assertEqual(person, logged_in)