Fix various lint warnings from ruff 0.16#5757
Open
randombit wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Botan’s Python/CI scripting to address lint warnings with Ruff 0.16 by adding a central Ruff configuration and applying many small, mostly behavior-preserving cleanups across scripts (imports, simplifications, safer subprocess usage, minor refactors).
Changes:
- Add a repo Ruff config (
src/configs/ruff.toml) and update CI to install/use Ruff 0.16 with that config. - Apply numerous Python script cleanups (import order,
raisevsraise e, small refactors, f-strings, set/dict literals, iteration simplifications). - Minor CI/script robustness improvements (e.g.,
subprocess.run(..., check=...), updated version checks).
Reviewed changes
Copilot reviewed 70 out of 70 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scripts/wycheproof.py | Add future annotations; simplify invalid-test checks |
| src/scripts/website.py | Import ordering; raise cleanup |
| src/scripts/tls_scanner/tls_scanner.py | Regex raw string; iteration/process handling cleanup |
| src/scripts/tls_anvil/tls_anvil_trigger_server.py | Import ordering cleanup |
| src/scripts/tls_anvil/run_tls_anvil_tests.py | Import ordering; path-based import |
| src/scripts/tls_anvil/analyze_tls_anvil_report.py | Small refactors (startswith tuple, next(...)) |
| src/scripts/test_strubbed_symbols.py | Import ordering cleanup |
| src/scripts/test_python.py | Import ordering; raise cleanup; small idioms |
| src/scripts/test_fuzzers.py | Import ordering; set/list iteration cleanups |
| src/scripts/test_cli.py | Import ordering; simplify conditionals |
| src/scripts/test_cli_crypt.py | Import ordering; refactors; super() modernization |
| src/scripts/test_all_configs.py | Import ordering cleanup |
| src/scripts/run_tls_fuzzer.py | Import ordering; simplify boolean returns |
| src/scripts/run_tls_attacker.py | Import ordering cleanup |
| src/scripts/run_tests_under_valgrind.py | subprocess.run args; list-flatten cleanup |
| src/scripts/run_limbo_tests.py | Import ordering; subprocess.run(check=...); condition simplification |
| src/scripts/rewrite_lcov.py | Import ordering cleanup |
| src/scripts/repo_config.py | Iterate file directly (no readlines()) |
| src/scripts/python_unittests.py | Import formatting and literals cleanup |
| src/scripts/python_unittests_unix.py | Import formatting cleanup |
| src/scripts/install.py | Import formatting; raise cleanup |
| src/scripts/gdb/strubtest.py | Whitespace cleanup |
| src/scripts/dist.py | Python version check simplification |
| src/scripts/dev_tools/xmss_test_vector_from_reference.py | f-strings and usage message cleanup |
| src/scripts/dev_tools/show_dependencies.py | Defaults/collections cleanup; import ordering |
| src/scripts/dev_tools/run_clang_tidy.py | Import order; text=True; conditional simplification |
| src/scripts/dev_tools/run_clang_format.py | Import ordering; simplify file filtering |
| src/scripts/dev_tools/macro_checks.py | Import ordering; endswith tuple |
| src/scripts/dev_tools/gen_tls_suite_info.py | Conditional simplification; urllib import ordering |
| src/scripts/dev_tools/gen_sphincsplus_kat.py | enumerate refactor; import ordering |
| src/scripts/dev_tools/gen_pqc_dsa_kats.py | Iterate dict directly; blank-line prints; closure default arg |
| src/scripts/dev_tools/gen_os_features.py | Print cleanup; import ordering |
| src/scripts/dev_tools/gen_oids.py | Import ordering cleanup |
| src/scripts/dev_tools/gen_mp_monty.py | Loop/range simplifications; writelines |
| src/scripts/dev_tools/gen_mp_comba.py | Loop/range simplifications |
| src/scripts/dev_tools/gen_mlkem_acvp_kat.py | Iterate dict directly; unused var rename |
| src/scripts/dev_tools/gen_kyber_kat.py | Import ordering; iterate dict directly |
| src/scripts/dev_tools/gen_frodo_kat.py | Import ordering; iterate dict directly |
| src/scripts/dev_tools/gen_ffi_decls.py | Whitespace cleanup |
| src/scripts/dev_tools/gen_ec_groups.py | Import ordering cleanup |
| src/scripts/dev_tools/gen_dilithium_kat.py | Import ordering cleanup |
| src/scripts/dev_tools/format_wycheproof_ecdsa.py | Import ordering cleanup |
| src/scripts/dev_tools/file_size_check.py | subprocess.run(check=True) |
| src/scripts/dev_tools/analyze_timing_results.py | Set literal cleanup; whitespace |
| src/scripts/dev_tools/addchain.py | Ignore unused stderr; set literal cleanup |
| src/scripts/create_corpus_zip.py | Import ordering cleanup |
| src/scripts/config_for_oss_fuzz.py | subprocess.run(check=True) |
| src/scripts/compare_perf.py | Import formatting cleanup |
| src/scripts/cleanup.py | Import ordering; conditional simplification |
| src/scripts/ci/setup_gh_actions.sh | Install Ruff ~0.16.0 |
| src/scripts/ci/gha_linux_packages.py | Whitespace cleanup |
| src/scripts/ci/gh_clang_tidy_fixes_in_pr.py | Future annotations; enumerate refactor |
| src/scripts/ci/download_ci_dep.py | Whitespace cleanup |
| src/scripts/ci_report_sizes.py | Remove encoding header; import ordering |
| src/scripts/ci_check_install.py | Remove encoding header; set literals |
| src/scripts/ci_check_headers.py | Remove encoding header; import ordering |
| src/scripts/ci_check_generated_files.py | Remove encoding header |
| src/scripts/ci_build.py | Run Ruff with explicit config; misc refactors |
| src/scripts/check.py | Import formatting cleanup |
| src/scripts/build_docs.py | Import ordering cleanup |
| src/scripts/bench.py | Import ordering; loop refactors |
| src/scripts/acvp_tests.py | Future annotations; small idioms (dict.get, tuple startswith) |
| src/python/botan3.py | Import formatting; TypeError; boolean simplifications; f-string |
| src/editors/vscode/scripts/test.py | Conditional simplification |
| src/editors/vscode/scripts/common.py | Import ordering cleanup |
| src/editors/vscode/scripts/bogo.py | Import ordering; path-based import |
| src/ct_selftest/ct_selftest.py | Future annotations; import ordering |
| src/configs/sphinx/conf.py | Remove encoding header; iterate file directly; strings cleanup |
| src/configs/ruff.toml | Add Ruff configuration (py38 target, ignores) |
| configure.py | Many small refactors to satisfy newer linting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) | ||
| from repo_config import RepoConfig # noqa: E402 | ||
| from repo_config import RepoConfig |
|
|
||
| sys.path.insert(0, os.path.join(REPO_ROOT, 'src', 'scripts')) | ||
| from repo_config import RepoConfig # noqa: E402 pylint: disable=wrong-import-position | ||
| from repo_config import RepoConfig # pylint: disable=wrong-import-position |
| # locale | ||
| sys.path.append(botan_root) | ||
| from configure import ModuleInfo # noqa: E402 | ||
| from configure import ModuleInfo |
| # locale | ||
| sys.path.append(botan_root) | ||
| from configure import OsInfo # noqa: E402 | ||
| from configure import OsInfo |
| sys.path.append("../..") # Botan repo root | ||
| from configure import AmalgamationHelper # pylint: disable=wrong-import-position | ||
| from configure import ModulesChooser # pylint: disable=wrong-import-position | ||
| from configure import ( # pylint: disable=wrong-import-position |
| sys.path.append("../..") # Botan repo root | ||
| from install import prepend_destdir # pylint: disable=wrong-import-position | ||
| from install import PrependDestdirError # pylint: disable=wrong-import-position | ||
| from install import ( # pylint: disable=wrong-import-position |
Contributor
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.