Skip to content

Commit

Permalink
ci: add ruff linter
Browse files Browse the repository at this point in the history
Only checks for unused imports for now, more rules can be added later.

Signed-off-by: Erik Larsson <who+github@cnackers.org>
  • Loading branch information
whooo committed Oct 2, 2024
1 parent 66acdbd commit e194913
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function run_style() {
"${PYTHON}" -m black --diff --check "${SRC_ROOT}"
}

function run_lint() {
ruff check "${SRC_ROOT}"
}

if [ "x${TEST}" != "x" ]; then
run_test
elif [ "x${WHITESPACE}" != "x" ]; then
Expand All @@ -111,4 +115,6 @@ elif [ "x${STYLE}" != "x" ]; then
run_style
elif [ "x${PUBLISH_PKG}" != "x" ]; then
run_publish_pkg
elif [ "x${LINT}" != "x" ]; then
run_lint()
fi
16 changes: 16 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,19 @@ jobs:
env:
STYLE: 1
run: ./.ci/run.sh

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Dependencies
run: |
python3 -m pip install --user --upgrade pip
python3 -m pip install --user --upgrade ruff
- name: Check
env:
LINT: 1
run: ./.ci/run.sh
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ exclude = '''
)
)
'''

[tool.ruff.lint]
select = ["F401"]
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ dev =
myst-parser
build
installer
ruff

0 comments on commit e194913

Please sign in to comment.