From b001d22cbc969ba037f908e5f70ab2d57a0ec2f7 Mon Sep 17 00:00:00 2001 From: taro <34352544+tarolling@users.noreply.github.com> Date: Sun, 23 Aug 2026 10:58:03 -0500 Subject: [PATCH 1/2] change python to python3 in shebang directive --- scripts/lint.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scripts/lint.py b/scripts/lint.py index 1339938c..539a6a07 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ Runs custom linting on Rust code. """ @@ -71,11 +71,8 @@ def lint_lines(filepath, lines_in): ) lines_out.append("#[inline]") - if re.search(r"TODO[^(]", line): - errors.append( - f"{filepath}:{line_nr}: write 'TODO(username):' instead" - ) + errors.append(f"{filepath}:{line_nr}: write 'TODO(username):' instead") if ( "(target_os" in line From 0d08ceb211ba2af939d5c8318a2aad0389365002 Mon Sep 17 00:00:00 2001 From: taro <34352544+tarolling@users.noreply.github.com> Date: Sun, 23 Aug 2026 11:00:11 -0500 Subject: [PATCH 2/2] apply ruff checks --- scripts/lint.py | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/scripts/lint.py b/scripts/lint.py index 539a6a07..93122e31 100755 --- a/scripts/lint.py +++ b/scripts/lint.py @@ -50,13 +50,8 @@ def lint_lines(filepath, lines_in): stripped = prev_line.strip() last_line_was_empty = ( stripped == "" - or stripped.startswith("#") - or stripped.startswith("//") - or stripped.endswith("{") - or stripped.endswith("(") - or stripped.endswith("\\") - or stripped.endswith('r"') - or stripped.endswith("]") + or stripped.startswith(("#", "//")) + or stripped.endswith(("{", "(", "\\", 'r"', "]")) ) if not last_line_was_empty: errors.append( @@ -64,12 +59,15 @@ def lint_lines(filepath, lines_in): ) lines_out.append("\n") - if re.search(r"\(mut self.*-> Self", line) and "pub(crate)" not in line: - if prev_line.strip() != "#[inline]": - errors.append( - f"{filepath}:{line_nr}: builder methods should be marked #[inline]" - ) - lines_out.append("#[inline]") + if ( + re.search(r"\(mut self.*-> Self", line) + and "pub(crate)" not in line + and prev_line.strip() != "#[inline]" + ): + errors.append( + f"{filepath}:{line_nr}: builder methods should be marked #[inline]" + ) + lines_out.append("#[inline]") if re.search(r"TODO[^(]", line): errors.append(f"{filepath}:{line_nr}: write 'TODO(username):' instead") @@ -133,8 +131,6 @@ def test_lint(): errors, _ = lint_lines("test.py", code.split("\n")) assert len(errors) > 0, f"expected this to fail:\n{code}" - pass - def main(): test_lint() # Make sure we are bug free before we run! @@ -163,7 +159,7 @@ def main(): root_dirpath = os.path.abspath(f"{script_dirpath}/..") os.chdir(root_dirpath) - exclude = set(["target", "target_ra", "target_wasm"]) + exclude = {"target", "target_ra", "target_wasm"} for root, dirs, files in os.walk(".", topdown=True): dirs[:] = [d for d in dirs if d not in exclude] for filename in files: