Skip to content

Fix various lint warnings from ruff 0.16#5757

Open
randombit wants to merge 1 commit into
masterfrom
jack/fix-for-ruff-0.16
Open

Fix various lint warnings from ruff 0.16#5757
randombit wants to merge 1 commit into
masterfrom
jack/fix-for-ruff-0.16

Conversation

@randombit

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, raise vs raise 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
@arckoor

arckoor commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

botan3.py format on the horizon as well? :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants