Skip to content

Commit 602c0b8

Browse files
committed
pyproject.toml: Update Ruff configuration with micropython-lib.
- Update to python 3.8 syntax. - Ignore import not at top of module warnings. - Exclude common SDK folders. - Exclude cpydiff test with intentional error. Also see: micropython/micropython-lib#1059 Signed-off-by: Jos Verlinde <[email protected]>
1 parent 2762fe6 commit 602c0b8

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

pyproject.toml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,17 @@ ACKNOWLEDGEMENTS,\
2222

2323
[tool.ruff]
2424
# Exclude third-party code from linting and formatting
25-
extend-exclude = ["lib"]
25+
extend-exclude = [
26+
"lib",
27+
"esp-idf",
28+
"pico-sdk",
29+
"emsdk",
30+
"tests/cpydiff/syntax_assign_expr.py" # intentionally incorrect CPython code
31+
]
2632
# Include Python source files that don't end with .py
2733
extend-include = ["tools/cc1"]
2834
line-length = 99
29-
target-version = "py37"
35+
target-version = "py38"
3036

3137
[tool.ruff.lint]
3238
exclude = [ # Ruff finds Python SyntaxError in these files
@@ -43,7 +49,7 @@ exclude = [ # Ruff finds Python SyntaxError in these files
4349
"tests/micropython/viper_args.py",
4450
]
4551
extend-select = ["C9", "PLC"]
46-
ignore = [
52+
extend-ignore = [
4753
"E401",
4854
"E402",
4955
"E722",
@@ -53,6 +59,7 @@ ignore = [
5359
"F403",
5460
"F405",
5561
"PLC0206",
62+
"PLC0415", # conditional imports are common in MicroPython
5663
]
5764
mccabe.max-complexity = 40
5865

@@ -64,6 +71,9 @@ mccabe.max-complexity = 40
6471
"**/manifest.py" = ["F821"]
6572
"ports/**/boards/**/manifest_*.py" = ["F821"]
6673

74+
"tests/cpydiff/syntax_assign_expr.py" = ["F821"] # uses assignment expressions
75+
76+
6777
[tool.ruff.format]
6878
# Exclude third-party code, and exclude the following tests:
6979
# basics: needs careful attention before applying automatic formatting

0 commit comments

Comments
 (0)