summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorChristian Clauss <cclauss@me.com>2023-03-08 16:09:36 +0100
committerDamien George <damien@micropython.org>2023-05-02 23:52:11 +1000
commit78a1aa171121a73a4785e249a5b38f8514d4502e (patch)
tree697bc38cee1fd59861619c33fad4192be0e8b583
parent2a1db770ce8d024b31bd1680e501e8b2a65f6570 (diff)
downloadmicropython-78a1aa171121a73a4785e249a5b38f8514d4502e.tar.gz
micropython-78a1aa171121a73a4785e249a5b38f8514d4502e.zip
github/workflows: Add GitHub Action to lint Python code with ruff.
Signed-off-by: Damien George <damien@micropython.org>
-rw-r--r--.github/workflows/ruff.yml10
-rw-r--r--pyproject.toml24
2 files changed, 34 insertions, 0 deletions
diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml
new file mode 100644
index 0000000000..b8e43dc78f
--- /dev/null
+++ b/.github/workflows/ruff.yml
@@ -0,0 +1,10 @@
+# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
+name: Python code lint with ruff
+on: [push, pull_request]
+jobs:
+ ruff:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v3
+ - run: pip install --user ruff
+ - run: ruff --format=github .
diff --git a/pyproject.toml b/pyproject.toml
index 3b2a9f3135..a52796860a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -22,3 +22,27 @@ skip = """
./tests,\
ACKNOWLEDGEMENTS,\
"""
+
+[tool.ruff]
+exclude = ["lib", "tests"]
+extend-select = ["C9", "PLC"]
+ignore = [
+ "E401",
+ "E402",
+ "E722",
+ "E731",
+ "E741",
+ "F401",
+ "F403",
+ "F405",
+ "F821",
+ "PLC1901",
+]
+line-length = 337
+target-version = "py37"
+
+[tool.ruff.mccabe]
+max-complexity = 40
+
+[tool.ruff.per-file-ignores]
+"ports/cc3200/tools/uniflash.py" = ["E711"]