This is an automated email from the ASF dual-hosted git repository.
dill0wn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
The following commit(s) were added to refs/heads/master by this push:
new 99d8e0e1c Update pre-commit yaml file versions, ignore a code on ruff
file, and change some methods that where failing after the update
99d8e0e1c is described below
commit 99d8e0e1c0763bc4d73ffaedb8b53acb4ab67689
Author: Daniel Castillo <[email protected]>
AuthorDate: Mon Aug 5 18:47:21 2024 +0000
Update pre-commit yaml file versions, ignore a code on ruff file, and
change some methods that where failing after the update
---
.pre-commit-config.yaml | 4 ++--
Allura/allura/app.py | 4 ++--
Allura/allura/controllers/rest.py | 2 +-
Allura/allura/lib/validators.py | 2 +-
Allura/allura/tests/test_helpers.py | 2 +-
ForgeTracker/forgetracker/model/ticket.py | 2 +-
ruff.toml | 2 +-
run_tests | 2 +-
8 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6526d003e..11a3c880c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -18,7 +18,7 @@
default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- rev: v4.5.0
+ rev: v4.6.0
hooks:
# general checks
- id: check-xml
@@ -98,7 +98,7 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
- rev: v0.3.3
+ rev: v0.5.5
hooks:
- id: ruff
types: [python]
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 2376f1102..5515cccfd 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -1007,9 +1007,9 @@ class DefaultAdminController(BaseController,
AdminControllerMixin):
# skip base options (mount_point, mount_label, ordinal)
continue
val = kw.get(opt.name, '')
- if opt.ming_type == bool:
+ if opt.ming_type is bool:
val = asbool(val or False)
- elif opt.ming_type == int:
+ elif opt.ming_type is int:
val = asint(val or 0)
try:
val = opt.validate(val)
diff --git a/Allura/allura/controllers/rest.py
b/Allura/allura/controllers/rest.py
index f5d1400d6..e0b54fd16 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -212,7 +212,7 @@ class Oauth1Validator(oauthlib.oauth1.RequestValidator):
if request.environ.get('paste.testing'):
# test suite is running
return False
- elif asbool(config.get('debug')) and
config['base_url'].startswith('http://'): # noqa: SIM103
+ elif asbool(config.get('debug')) and
config['base_url'].startswith('http://'):
# development w/o https
return False
else:
diff --git a/Allura/allura/lib/validators.py b/Allura/allura/lib/validators.py
index c2e5374d1..9bce7b396 100644
--- a/Allura/allura/lib/validators.py
+++ b/Allura/allura/lib/validators.py
@@ -348,7 +348,7 @@ class UserMapJsonFile(JsonFile):
try:
for k, v in value.items():
if not (isinstance(k, str) and isinstance(v, str)):
- raise
+ raise # noqa: PLE0704
return json.dumps(value) if self.as_string else value
except Exception:
raise fe.Invalid(
diff --git a/Allura/allura/tests/test_helpers.py
b/Allura/allura/tests/test_helpers.py
index 1504a1adb..50a6e6e11 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -718,7 +718,7 @@ def test_hide_private_info():
assert h.hide_private_info('foo bar [email protected]') == 'foo bar baz@...'
assert h.hide_private_info('some <[email protected]>\nor [email protected]') ==
'some <1@...>\nor asdf+asdf.f@...'
safe_markup_converted = h.hide_private_info(Markup('foo bar
[email protected]'))
- assert type(safe_markup_converted) == Markup
+ assert type(safe_markup_converted) is Markup
assert safe_markup_converted == Markup('foo bar baz@...')
with h.push_config(h.tg.config, hide_private_info=False):
diff --git a/ForgeTracker/forgetracker/model/ticket.py
b/ForgeTracker/forgetracker/model/ticket.py
index 1b80511d8..9ca5a77bf 100644
--- a/ForgeTracker/forgetracker/model/ticket.py
+++ b/ForgeTracker/forgetracker/model/ticket.py
@@ -1196,7 +1196,7 @@ class Ticket(VersionedArtifact, ActivityObject,
VotableArtifact):
def __json__(self, posts_limit=None, is_export=False):
parents_json = {}
for parent in reversed(type(self).mro()):
- if parent != type(self) and hasattr(parent, '__json__'):
+ if parent is not type(self) and hasattr(parent, '__json__'):
kwargs = {}
if parent == VersionedArtifact:
kwargs['posts_limit'] = posts_limit
diff --git a/ruff.toml b/ruff.toml
index 6df46f41d..f84770897 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -37,7 +37,6 @@ lint.select = [
"PLE",
"PLW",
"SIM101",
- "SIM103",
"SIM117",
"SIM2",
"SIM401",
@@ -66,6 +65,7 @@ lint.ignore = [
'S603', # subprocess
'S607', # partial path
'PLW2901', # loop var overwritten
+ 'SIM103', #Return the condition `bool(raised and isinstance(raised,
HTTPFound))` directly
]
[lint.per-file-ignores]
diff --git a/run_tests b/run_tests
index 99aa681a9..e83aec083 100755
--- a/run_tests
+++ b/run_tests
@@ -84,7 +84,7 @@ def run_many(cmds, processes=None):
async_results = []
for cmd_kwds in cmds:
- if type(cmd_kwds) == ():
+ if type(cmd_kwds) == (): # noqa: E721
cmd = cmd_kwds
kwds = {}
else: