Skip to content

Commit c566a65

Browse files
committed
Make lint script return non-zero upon any change
So that the CI fails when reformatting needed to occur.
1 parent ccceaa7 commit c566a65

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bin/lint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@ dir=$(dirname "$0")
44
cd "$dir/.."
55

66
exitCode=0
7+
8+
# Check for errors and capture non-zero exit codes.
79
uv run validate-pyproject pyproject.toml
810
code=$?; test $code -eq 0 || exitCode=$code
11+
uv run ruff check >/dev/null 2>&1
12+
code=$?; test $code -eq 0 || exitCode=$code
13+
uv run ruff format --check >/dev/null 2>&1
14+
code=$?; test $code -eq 0 || exitCode=$code
15+
16+
# Do actual code reformatting.
917
uv run ruff check --fix
1018
code=$?; test $code -eq 0 || exitCode=$code
1119
uv run ruff format
1220
code=$?; test $code -eq 0 || exitCode=$code
21+
1322
exit $exitCode

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ dev = [
4747
"pandas",
4848
"ruff",
4949
"toml",
50-
"validate-pyproject[all]"
50+
"validate-pyproject[all]",
5151
]
5252

5353
[project.urls]
@@ -65,7 +65,6 @@ include-package-data = false
6565
where = ["src"]
6666
namespaces = false
6767

68-
# ruff configuration
6968
[tool.ruff]
7069
line-length = 88
7170
src = ["src", "tests"]

0 commit comments

Comments
 (0)