From 2e52a255628ec0dfa1ba20b243d7ea29f9763174 Mon Sep 17 00:00:00 2001 From: zyf722 Date: Wed, 4 Sep 2024 21:27:26 +0800 Subject: [PATCH] ci: add ruff, isort and mypy for code quality check --- .github/workflows/build.yml | 14 ++++++++++++++ pyproject.toml | 2 ++ 2 files changed, 16 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1719476..d722cc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,9 +22,23 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Install code quality tools + run: pipx install ruff isort mypy + - name: Check for typos uses: crate-ci/typos@master + - name: Lint code and check code formatting using ruff + run: | + ruff check --output-format=github . + ruff format --check . + + - name: Type-check code using mypy + run: mypy --check-untyped-defs . + + - name: Check import order using isort + run: isort -c --profile black . + build: strategy: matrix: diff --git a/pyproject.toml b/pyproject.toml index 0abfaa8..368cbb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,6 +42,8 @@ execenv = "execenv:execenv" "execenv-completion" = "execenv:execenv_completion" "execenv-echo" = "execenv:execenv_echo" +[tool.ruff.lint] +ignore = ["E501"] [build-system] requires = ["poetry-core"]