diff --git a/.ruff.toml b/.ruff.toml new file mode 100644 index 000000000..44b788c48 --- /dev/null +++ b/.ruff.toml @@ -0,0 +1,31 @@ +# Lint all .py files and extra python scripts without extensions +include = ["*.py", "bin/wsim", "bin/regression-wally", "bin/iterelf", "sim/vcs/run_vcs"] +exclude = ["addins/*", "tests/wally-riscv-arch-test/riscv-test-suite/rv64i_m/Q/*", "tests/fp/quad/fpdatasetgen.py"] + +# Target oldest version of Python used (Python 3.9 for Ubuntu 20.04 LTS) +target-version = "py39" + +line-length=250 + +[lint] +select = [ + "F", # various basic rules + "E101", # indentation contains mixed spaces and tabs + "E4", # imports + "E7", # various improvements + "E9", # error + "W1", # tabs used instead of spaces + "W292", # no newline at end of file + "UP", # Upgraded version available in newer Python + "EXE", # Executable file shebangs + "Q003", # Avoidable escaped quotes + "Q004", # Unnecessary esacpe character + "RUF", # Ruff specific rules +] + +ignore = [ + "E701", "E702", # multiple statements on one line + "E722", # do not use bare 'except' + "E74", # ambiguous name + "RUF005", # iterable unpacking in list +]