You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2023/03/10 22:02:16 UTC
[allura] 01/03: [#8502] ignoring long lines and updating ruff command with --config and --show-source flags
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit a20a412850e06276e5a731ba6280474cb4a6bc89
Author: Guillermo Cruz <gu...@slashdotmedia.com>
AuthorDate: Thu Mar 9 22:34:19 2023 +0000
[#8502] ignoring long lines and updating ruff command with --config and --show-source flags
---
AlluraTest/alluratest/test_syntax.py | 14 +++++++-------
ruff.toml | 1 +
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/AlluraTest/alluratest/test_syntax.py b/AlluraTest/alluratest/test_syntax.py
index 7272da81f..da40861de 100644
--- a/AlluraTest/alluratest/test_syntax.py
+++ b/AlluraTest/alluratest/test_syntax.py
@@ -23,7 +23,7 @@ from unittest import SkipTest
from six.moves import zip_longest
toplevel_dir = os.path.abspath(os.path.dirname(__file__) + "/../..")
-
+BASE_PATH = (toplevel_dir,) #freeze main path
def run(cmd):
proc = Popen(cmd, shell=True, cwd=toplevel_dir, stdout=PIPE, stderr=PIPE)
@@ -77,11 +77,11 @@ def run_linter(files):
raise Exception('Custom Allura pylint errors found.')
-def run_pyflakes(files):
+def run_ruff(files):
# skip some that aren't critical errors
files = [f for f in files if '/migrations/' not in f]
- cmd = "ruff check " + ' '.join(files) + " --show-source"
- if run(cmd) != 1:
+ cmd = f"ruff check {' '.join(files)} --config {BASE_PATH[0]}/ruff.toml --show-source"
+ if run(cmd) != 0:
# print 'Command was: %s' % cmd
raise Exception('ruff failure, see stdout')
@@ -112,9 +112,9 @@ def create_many_lint_methods():
lint_test_method.__name__ = str(f'test_pylint_{i}')
setattr(TestLinters, f'test_pylint_{i}', lint_test_method)
- pyflake_test_method = lambda self, these_files=files: run_pyflakes(these_files)
- pyflake_test_method.__name__ = str(f'test_pyflakes_{i}')
- setattr(TestLinters, f'test_pyflakes_{i}', pyflake_test_method)
+ pyflake_test_method = lambda self, these_files=files: run_ruff(these_files)
+ pyflake_test_method.__name__ = str(f'test_ruff_{i}')
+ setattr(TestLinters, f'test_ruff_{i}', pyflake_test_method)
create_many_lint_methods()
diff --git a/ruff.toml b/ruff.toml
index 7ea3f6a70..1b7a345a0 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -11,6 +11,7 @@ ignore = [
'E402', # Module level import not at top of file
'E731', # Do not assign a lambda expression, use a def
'E741', # Ambiguous variable name: I,
+ 'E501' # Line too long
]
line-length = 119