From 643f61e7f4c6e1ace30c8bae747afb28c6ffb617 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Sat, 25 Oct 2025 00:19:42 +0200 Subject: [PATCH] Core: Add a ruff.toml to the root directory (#5259) * Add a ruff.toml to the root directory * spell out C901 * Add target version * Add some more of the suggested rules * ignore PLC0415 * TC is bad * ignore B0011 * ignore N818 * Ignore some more rules * Add PLC1802 to ignore list * Update ruff.toml Co-authored-by: Doug Hoskisson * oops * R to RET and RSC * oops * Py311 * Update ruff.toml --------- Co-authored-by: Doug Hoskisson --- ruff.toml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 ruff.toml diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 00000000..ee2830cc --- /dev/null +++ b/ruff.toml @@ -0,0 +1,16 @@ +line-length = 120 +indent-width = 4 +target-version = "py311" + +[lint] +select = ["B", "C", "E", "F", "W", "I", "N", "Q", "UP", "RET", "RSE", "RUF", "ISC", "PLC", "PLE", "PLW", "T20", "PERF"] +ignore = [ + "B011", # In AP, the use of assert False is essential because we optimise out these statements for release builds. + "C901", # Author disagrees with limiting branch complexity + "N818", # Author agrees with this rule, but Core AP violates this and changing it would be a hassle. + "PLC0415", # In AP, we consider local imports totally fine & necessary + "PLC1802", # Author agrees with this rule, but it literally changes the functionality of the code, which is unsafe. + "PLC1901", # This is just not equivalent + "PLE1141", # Gives false positives when the dict keys are tuples, but does not mention this in the suggested fix. + "UP015", # Explicit is better than implicit, so we'd prefer to keep "r" in open() calls. +]