[#8539] add some pylint checks
diff --git a/Allura/allura/command/base.py b/Allura/allura/command/base.py
index 65b7c75..de09018 100644
--- a/Allura/allura/command/base.py
+++ b/Allura/allura/command/base.py
@@ -87,7 +87,7 @@
return tg.config
def basic_setup(self):
- global log, M
+ global log, M # noqa: PLW0603
if self.args[0]:
# Probably being called from the command line - load the config
# file
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 5f5c41b..26d0314 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -32,7 +32,7 @@
import logging
import string
import random
-import pickle as pickle
+import pickle
from hashlib import sha1
from datetime import datetime, timedelta
from collections import defaultdict, OrderedDict
diff --git a/Allura/allura/lib/patches.py b/Allura/allura/lib/patches.py
index 7c6e416..964624d 100644
--- a/Allura/allura/lib/patches.py
+++ b/Allura/allura/lib/patches.py
@@ -29,7 +29,7 @@
_patched = False
def apply():
- global _patched
+ global _patched # noqa: PLW0603
if _patched:
return
_patched = True
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index f87f435..100f9b2 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -426,8 +426,7 @@
if 'attachment' in alink['href']:
alink = str(alink['href'])
return alink
- else:
- assert False, 'attachment link not found'
+ assert False, 'attachment link not found'
def test_attach(self):
r = self.app.post(self.post_link + 'attach',
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index eadd141..21cfa67 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -56,7 +56,7 @@
REGISTRY.register(ew.widget_context,
ew.core.WidgetContext('http', ew.ResourceManager()))
- create_test_data = asbool(os.getenv('ALLURA_TEST_DATA', True))
+ create_test_data = asbool(os.getenv('ALLURA_TEST_DATA', 'true'))
# if this is a test_run, skip user project creation to save time
make_user_projects = not test_run
diff --git a/ruff.toml b/ruff.toml
index 7da9443..4337590 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -33,6 +33,9 @@
"G010", # logging.warn
"T10", # debugger breakpoints
"T20", # print()
+ "PLC",
+ "PLE",
+ "PLW",
"FA", # future annotations (to ensure compatibility with `target-version`)
]
@@ -57,6 +60,7 @@
'S324', # md5 & sha1
'S603', # subprocess
'S607', # partial path
+ 'PLW2901', # loop var overwritten
]
[lint.per-file-ignores]
diff --git a/scripts/ApacheAccessHandler.py b/scripts/ApacheAccessHandler.py
index 217e4ec..fc10499 100644
--- a/scripts/ApacheAccessHandler.py
+++ b/scripts/ApacheAccessHandler.py
@@ -52,7 +52,7 @@
exec(compile(open(activate_this, "rb").read(), activate_this, 'exec'), {'__file__': activate_this}) # noqa: S102
except Exception as e:
log(req, "Couldn't activate venv via {}: {}".format(activate_this, repr(e)))
- global requests
+ global requests # noqa: PLW0603
import requests as requests_lib
requests = requests_lib