launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #31652
[Merge] ~lgp171188/launchpad:upgrade-pre-commit-hooks into launchpad:master
Guruprasad has proposed merging ~lgp171188/launchpad:upgrade-pre-commit-hooks into launchpad:master.
Commit message:
Upgrade pre-commit hooks
And fix issues reported by the upgraded linters
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/474545
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:upgrade-pre-commit-hooks into launchpad:master.
diff --git a/.codespell-ignore b/.codespell-ignore
index b855d06..f38f201 100644
--- a/.codespell-ignore
+++ b/.codespell-ignore
@@ -1,3 +1,5 @@
+assertIn
+biding
buildd
changee
coo
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index e3f66a9..0000000
--- a/.eslintignore
+++ /dev/null
@@ -1,5 +0,0 @@
-# Third-party modules, albeit modified somewhat for Launchpad.
-lib/lp/app/javascript/ellipsis.js
-lib/lp/app/javascript/gallery-accordion/gallery-accordion.js
-lib/lp/app/javascript/mustache.js
-lib/lp/app/javascript/sorttable/sorttable.js
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 4570489..145895b 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.5.0
+ rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
@@ -26,7 +26,7 @@ repos:
- id: no-commit-to-branch
args: [--branch, master, --branch, db-devel]
- repo: https://github.com/asottile/pyupgrade
- rev: v3.15.0
+ rev: v3.17.0
hooks:
- id: pyupgrade
args: [--keep-percent-format, --py38-plus]
@@ -36,7 +36,7 @@ repos:
|utilities/community-contributions\.py
)$
- repo: https://github.com/psf/black-pre-commit-mirror
- rev: 24.1.1
+ rev: 24.8.0
hooks:
- id: black
exclude: |
@@ -45,13 +45,13 @@ repos:
|utilities/community-contributions\.py
)$
- repo: https://github.com/PyCQA/isort
- rev: 5.12.0
+ rev: 5.13.2
hooks:
- id: isort
name: isort
args: [--profile, black]
- repo: https://github.com/PyCQA/flake8
- rev: 5.0.4
+ rev: 7.1.1
hooks:
- id: flake8
exclude: ^lib/contrib/
@@ -59,7 +59,7 @@ repos:
- flake8-absolute-import==1.0.0.1
- flake8-bugbear==23.3.12
- repo: https://github.com/pre-commit/mirrors-eslint
- rev: v8.53.0
+ rev: v9.12.0
hooks:
- id: eslint
args: [--quiet]
@@ -79,11 +79,11 @@ repos:
args: [--allow-option-flag, IGNORE_EXCEPTION_MODULE_IN_PYTHON2]
exclude: ^doc/.*
- repo: https://github.com/shellcheck-py/shellcheck-py
- rev: v0.9.0.6
+ rev: v0.10.0.1
hooks:
- id: shellcheck
- repo: https://github.com/codespell-project/codespell
- rev: v2.2.6
+ rev: v2.3.0
hooks:
- id: codespell
args: ["-I", ".codespell-ignore"]
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..b3995be
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,9 @@
+// eslint.config.js
+module.exports = {
+ ignores: [
+ "lib/lp/app/javascript/ellipsis.js",
+ "lib/lp/app/javascript/gallery-accordion/gallery-accordion.js",
+ "lib/lp/app/javascript/mustache.js",
+ "lib/lp/app/javascript/sorttable/sorttable.js"
+ ]
+};
diff --git a/lib/lp/archiveuploader/tests/nascentupload.rst b/lib/lp/archiveuploader/tests/nascentupload.rst
index 989a31f..f619790 100644
--- a/lib/lp/archiveuploader/tests/nascentupload.rst
+++ b/lib/lp/archiveuploader/tests/nascentupload.rst
@@ -335,7 +335,7 @@ Roll back everything related with ed_upload:
Acceptance Work-flow
--------------------
-The NascentUpload.do_accept method is the code which effectivelly adds
+The NascentUpload.do_accept method is the code which effectively adds
information to the database. Respective PackageUploadQueue,
SourcePackageRelease, Build and BinaryPackageRelease will only exist
after calling this method.
diff --git a/lib/lp/bugs/doc/bug-tags.rst b/lib/lp/bugs/doc/bug-tags.rst
index 9a9c0f9..6b797a2 100644
--- a/lib/lp/bugs/doc/bug-tags.rst
+++ b/lib/lp/bugs/doc/bug-tags.rst
@@ -41,11 +41,11 @@ look at it we can see that the added tags are there.
So if we add another tag by setting the 'tags' attribute to a new list.
The tag will be added in the table.
- >>> bug_one.tags = ["svg", "sco", "installl"]
+ >>> bug_one.tags = ["svg", "sco", "install"]
>>> for tag in bug_one.tags:
... print(tag)
...
- installl
+ install
sco
svg
>>> from lp.services.database.interfaces import IStore
@@ -62,18 +62,18 @@ The tag will be added in the table.
>>> for bugtag in bugtags:
... print(bugtag.tag)
...
- installl
+ install
sco
svg
We allow adding the same tag twice, but it won't be stored twice in the
db:
- >>> bug_one.tags = ["svg", "svg", "sco", "installl"]
+ >>> bug_one.tags = ["svg", "svg", "sco", "install"]
>>> for tag in bug_one.tags:
... print(tag)
...
- installl
+ install
sco
svg
diff --git a/lib/lp/bugs/javascript/tests/test_filebug.js b/lib/lp/bugs/javascript/tests/test_filebug.js
index b73df41..2135395 100644
--- a/lib/lp/bugs/javascript/tests/test_filebug.js
+++ b/lib/lp/bugs/javascript/tests/test_filebug.js
@@ -186,27 +186,27 @@ YUI.add('lp.bugs.filebug.test', function (Y) {
// banner remains on for private_by_default bugs.
test_unselect_security_related_default_private: function () {
window.LP.cache.bug_private_by_default = true;
- var public = 0;
- var private = 0;
+ var public_ = 0;
+ var private_ = 0;
var ev_public = Y.on(info_type.EV_ISPUBLIC, function (ev) {
- public = public + 1;
+ public_ = public_ + 1;
});
var ev_private = Y.on(info_type.EV_ISPRIVATE, function (ev) {
- private = private + 1;
+ private_ = private_ + 1;
});
this.setupForm(false);
- Y.Assert.areEqual(1, private, 'Private is the default state.');
+ Y.Assert.areEqual(1, private_, 'Private is the default state.');
Y.one('[id="field.security_related"]').simulate('click');
- Y.Assert.areEqual(2, private, 'The first click fires ISPRIVATE');
+ Y.Assert.areEqual(2, private_, 'The first click fires ISPRIVATE');
Y.one('[id="field.security_related"]').simulate('click');
- Y.Assert.areEqual(1, public, 'The second click fires ISPUBLIC');
+ Y.Assert.areEqual(1, public_, 'The second click fires ISPUBLIC');
Y.Assert.areEqual(
- 3, private,
+ 3, private_,
"It also fires an ISPRIVATE since that's the default state.");
ev_private.detach();
ev_public.detach();
diff --git a/lib/lp/bugs/mail/errortemplates/user-cannot-unsubscribe.txt b/lib/lp/bugs/mail/errortemplates/user-cannot-unsubscribe.txt
index dbea937..49ff9e6 100644
--- a/lib/lp/bugs/mail/errortemplates/user-cannot-unsubscribe.txt
+++ b/lib/lp/bugs/mail/errortemplates/user-cannot-unsubscribe.txt
@@ -1 +1 @@
-You do not have permission to unsubcribe %(person)s.
+You do not have permission to unsubscribe %(person)s.
diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py
index d8170b6..e2a8600 100644
--- a/lib/lp/bugs/model/bugtasksearch.py
+++ b/lib/lp/bugs/model/bugtasksearch.py
@@ -252,7 +252,7 @@ def search_bugs(pre_iter_hook, alternatives, just_bug_ids=False):
# users are combined.
decorators.append(decorator)
- resultset = reduce(lambda l, r: l.union(r), results)
+ resultset = reduce(lambda left, right: left.union(right), results)
origin = _build_origin(
orderby_joins, [], Alias(resultset._get_select(), "BugTaskFlat")
)
diff --git a/lib/lp/bugs/tests/bugs-emailinterface.rst b/lib/lp/bugs/tests/bugs-emailinterface.rst
index 6555137..75daf6a 100644
--- a/lib/lp/bugs/tests/bugs-emailinterface.rst
+++ b/lib/lp/bugs/tests/bugs-emailinterface.rst
@@ -850,7 +850,7 @@ the unsubscribe request, an error message will be sent.
To: no-priv@xxxxxxxxxxxxx
<BLANKLINE>
...
- You do not have permission to unsubcribe Mark Shuttleworth.
+ You do not have permission to unsubscribe Mark Shuttleworth.
...
Unsubscribing from a bug also unsubscribes you from its duplicates. To
@@ -3254,7 +3254,7 @@ importing machinery.
...
... Oh, hai!
...
- ... I'm in ur comments, sendin u a msej.
+ ... I'm in your comments, sending you a message.
... """
... % {
... "bug_id": bug_with_watch.id,
diff --git a/lib/lp/code/model/codeimportevent.py b/lib/lp/code/model/codeimportevent.py
index 8070bec..8fad700 100644
--- a/lib/lp/code/model/codeimportevent.py
+++ b/lib/lp/code/model/codeimportevent.py
@@ -213,7 +213,7 @@ class CodeImportEventSet:
"""See `ICodeImportEventSet`."""
assert machine is not None, "machine must not be None"
assert (
- type(reason) == DBItem
+ isinstance(reason, DBItem)
and reason.enum == CodeImportMachineOfflineReason
), (
"reason must be a CodeImportMachineOfflineReason value, "
diff --git a/lib/lp/code/xmlrpc/codehosting.py b/lib/lp/code/xmlrpc/codehosting.py
index cc8e6ea..907d78d 100644
--- a/lib/lp/code/xmlrpc/codehosting.py
+++ b/lib/lp/code/xmlrpc/codehosting.py
@@ -390,7 +390,9 @@ class CodehostingAPI(LaunchpadXMLRPCView):
if not path.startswith("/"):
return faults.InvalidPath(path)
stripped_path = unescape(path.strip("/"))
- lookup = lambda l: self.performLookup(requester_id, path, l)
+ lookup = lambda lookup: self.performLookup(
+ requester_id, path, lookup
+ )
result = get_first_path_result(stripped_path, lookup, None)
if result is None:
raise faults.PathTranslationError(path)
diff --git a/lib/lp/codehosting/inmemory.py b/lib/lp/codehosting/inmemory.py
index 159ff22..c4ba903 100644
--- a/lib/lp/codehosting/inmemory.py
+++ b/lib/lp/codehosting/inmemory.py
@@ -934,8 +934,8 @@ class FakeCodehosting:
elif lookup["type"] == "alias":
result = get_first_path_result(
lookup["lp_path"],
- lambda l: self.performLookup(
- requester_id, l, branch_name_only=True
+ lambda lookup: self.performLookup(
+ requester_id, lookup, branch_name_only=True
),
None,
)
@@ -967,7 +967,7 @@ class FakeCodehosting:
return faults.InvalidPath(path)
result = get_first_path_result(
unescape(path.strip("/")),
- lambda l: self.performLookup(requester_id, l),
+ lambda lookup: self.performLookup(requester_id, lookup),
None,
)
if result is not None:
diff --git a/lib/lp/registry/browser/tests/distroseries-views.rst b/lib/lp/registry/browser/tests/distroseries-views.rst
index b05fff4..725129f 100644
--- a/lib/lp/registry/browser/tests/distroseries-views.rst
+++ b/lib/lp/registry/browser/tests/distroseries-views.rst
@@ -223,7 +223,7 @@ A distroseries is created using the distroseries view.
>>> view.field_names
['name', 'version', 'display_name', 'summary']
-A distroseries is created whent the required field are submitted.
+A distroseries is created when the required field are submitted.
>>> form = {
... "field.name": "sane",
diff --git a/lib/lp/registry/browser/tests/test_distroseries.py b/lib/lp/registry/browser/tests/test_distroseries.py
index 30b4642..d43c9fd 100644
--- a/lib/lp/registry/browser/tests/test_distroseries.py
+++ b/lib/lp/registry/browser/tests/test_distroseries.py
@@ -253,7 +253,7 @@ class DistroSeriesIndexFunctionalTestCase(TestCaseWithFactory):
# 'parent_name').
# If multiple parents are created, the DSDs will be created with
# the first one.
- if type(parent_names) == str:
+ if isinstance(parent_names, str):
parent_names = [parent_names]
dsps = []
for parent_name in parent_names:
diff --git a/lib/lp/registry/vocabularies.py b/lib/lp/registry/vocabularies.py
index 79e938c..2e5f31f 100644
--- a/lib/lp/registry/vocabularies.py
+++ b/lib/lp/registry/vocabularies.py
@@ -1941,7 +1941,7 @@ class PillarVocabularyBase(NamedStormHugeVocabulary):
def toTerm(self, obj):
"""See `IVocabulary`."""
- if type(obj) == int:
+ if isinstance(obj, int):
return self.toTerm(IStore(PillarName).get(PillarName, obj))
if IPillarName.providedBy(obj):
assert obj.active, "Inactive object %s %d" % (
diff --git a/lib/lp/services/comments/browser/messagecomment.py b/lib/lp/services/comments/browser/messagecomment.py
index 93eb4a5..b6afd2c 100644
--- a/lib/lp/services/comments/browser/messagecomment.py
+++ b/lib/lp/services/comments/browser/messagecomment.py
@@ -12,8 +12,6 @@ from lp.services.propertycache import cachedproperty
class MessageComment:
"""Mixin to partially implement IComment in terms of IMessage."""
- extra_css_class = ""
-
has_footer = False
def __init__(self, comment_limit):
diff --git a/lib/lp/services/doc/limitedlist.rst b/lib/lp/services/doc/limitedlist.rst
index dd13b45..df50a39 100644
--- a/lib/lp/services/doc/limitedlist.rst
+++ b/lib/lp/services/doc/limitedlist.rst
@@ -61,7 +61,7 @@ Inline addition is also possible.
<LimitedList(3, [2, 3, 4])>
We can multiply lists by integers. Again, if the length of the result
-exceeds the maximum number of allowed lements, the first elements
+exceeds the maximum number of allowed elements, the first elements
are dropped.
>>> LimitedList(5, [4, 5, 6]) * 2
diff --git a/lib/lp/services/scripts/base.py b/lib/lp/services/scripts/base.py
index 4674109..967e678 100644
--- a/lib/lp/services/scripts/base.py
+++ b/lib/lp/services/scripts/base.py
@@ -138,7 +138,6 @@ class LaunchpadScript:
txn = None
usage: Optional[str] = None
description: Optional[str] = None
- lockfilepath = None
loglevel = logging.INFO
# State for the log_unhandled_exceptions decorator.
diff --git a/lib/lp/services/utils.py b/lib/lp/services/utils.py
index ab3878a..4ab4432 100644
--- a/lib/lp/services/utils.py
+++ b/lib/lp/services/utils.py
@@ -62,7 +62,7 @@ class AutoDecorateMetaClass(type):
decorators = class_dict.pop(f"_{class_name}__decorators", None)
if decorators is not None:
for name, value in class_dict.items():
- if type(value) == FunctionType:
+ if isinstance(value, FunctionType):
for decorator in decorators:
value = decorator(value)
assert callable(
diff --git a/lib/lp/soyuz/browser/archive.py b/lib/lp/soyuz/browser/archive.py
index fc82b21..7c701f4 100644
--- a/lib/lp/soyuz/browser/archive.py
+++ b/lib/lp/soyuz/browser/archive.py
@@ -1274,7 +1274,6 @@ class ArchivePackageDeletionView(ArchiveSourceSelectionFormView):
custom_widget_deletion_comment = CustomWidgetFactory(
StrippedTextWidget, displayWidth=50
)
- label = "Delete packages"
@property
def label(self):
@@ -1560,7 +1559,6 @@ class ArchivePackageCopyingView(
custom_widget_destination_archive = DestinationArchiveDropdownWidget
custom_widget_destination_series = DestinationSeriesDropdownWidget
custom_widget_include_binaries = LaunchpadRadioWidget
- label = "Copy packages"
@property
def label(self):
diff --git a/lib/lp/translations/browser/person.py b/lib/lp/translations/browser/person.py
index b5e8361..4f2f0d4 100644
--- a/lib/lp/translations/browser/person.py
+++ b/lib/lp/translations/browser/person.py
@@ -108,10 +108,6 @@ def compose_pofile_filter_url(pofile, person):
class ActivityDescriptor:
"""Description of a past translation activity."""
- date = None
- title = None
- url = None
-
def __init__(self, person, pofiletranslator):
"""Describe a past translation activity by `person`.