This is an automated email from the ASF dual-hosted git repository.

gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 468ed4636e05684ef43a3a970f99a540411d65d1
Author: Dave Brondsema <[email protected]>
AuthorDate: Wed Mar 20 17:10:45 2024 -0400

    [#8539] add some pylint checks
---
 Allura/allura/command/base.py                  | 2 +-
 Allura/allura/lib/helpers.py                   | 2 +-
 Allura/allura/lib/patches.py                   | 2 +-
 Allura/allura/tests/functional/test_discuss.py | 3 +--
 Allura/allura/websetup/bootstrap.py            | 2 +-
 ruff.toml                                      | 4 ++++
 scripts/ApacheAccessHandler.py                 | 2 +-
 7 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Allura/allura/command/base.py b/Allura/allura/command/base.py
index 65b7c758e..de09018c9 100644
--- a/Allura/allura/command/base.py
+++ b/Allura/allura/command/base.py
@@ -87,7 +87,7 @@ class Command(command.Command, metaclass=MetaParserDocstring):
         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 5f5c41bdf..26d031446 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -32,7 +32,7 @@ import json
 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 7c6e416eb..964624d0b 100644
--- a/Allura/allura/lib/patches.py
+++ b/Allura/allura/lib/patches.py
@@ -29,7 +29,7 @@ import six
 
 _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 f87f4352d..100f9b276 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -426,8 +426,7 @@ class TestAttachment(TestDiscussBase):
             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 eadd141e9..21cfa6781 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -56,7 +56,7 @@ def bootstrap(command, conf, vars):
         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 7da944339..4337590c5 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -33,6 +33,9 @@ lint.select = [
     "G010", # logging.warn
     "T10",  # debugger breakpoints
     "T20",  # print()
+    "PLC",
+    "PLE",
+    "PLW",
     "FA",   # future annotations (to ensure compatibility with 
`target-version`)
 ]
 
@@ -57,6 +60,7 @@ lint.ignore = [
     '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 217e4ecf6..fc10499a1 100644
--- a/scripts/ApacheAccessHandler.py
+++ b/scripts/ApacheAccessHandler.py
@@ -52,7 +52,7 @@ def load_requests_lib(req):
             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
 

Reply via email to