Skip to content

Commit

Permalink
Adjust configuration and code checking workflow.
Browse files Browse the repository at this point in the history
- Completely ignore certain ruleset files (instead of only ignoring
  checking certain Ruff rules).
- Add check for formatting in `run_checks.sh`.
  • Loading branch information
ioannis-vm committed Oct 28, 2024
1 parent 12d0f43 commit d36706a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
line-length = 85
exclude = [
"rulesets",
"pelicun/tests/dl_calculation/e7/auto_HU_NJ.py",
"pelicun/tests/dl_calculation/e8/auto_HU_LA.py",
"pelicun/tests/dl_calculation/e9/custom_pop.py"
]

Expand All @@ -27,9 +29,6 @@ max-bool-expr=5
"pelicun/resources/auto/*" = ['PLR', 'T', 'N', 'ANN', 'D', 'PTH', 'INP', 'DOC', 'RET', 'TD']
"pelicun/tools/HDF_to_CSV.py" = ["ALL"]
"pelicun/tests/validation/inactive/*" = ["T201", "B018", "ANN", "PD"]
"pelicun/tests/dl_calculation/e7/auto_HU_NJ.py" = ["ALL"]
"pelicun/tests/dl_calculation/e8/auto_HU_LA.py" = ["ALL"]
"pelicun/tests/dl_calculation/e9/custom_pop.py" = ["ALL"]

[tool.ruff.format]
quote-style = "single"
Expand Down
11 changes: 10 additions & 1 deletion run_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,21 @@ if [ $? -ne 0 ]; then
exit 1
fi

# Check formatting with ruff
echo "Checking formatting with 'ruff format --diff'."
echo
ruff format --diff
if [ $? -ne 0 ]; then
echo "ruff format failed."
exit 1
fi

# Run ruff for linting
echo "Linting with 'ruff check --fix'."
echo
ruff check --fix --output-format concise
if [ $? -ne 0 ]; then
echo "ruff failed."
echo "ruff check failed."
exit 1
fi

Expand Down

0 comments on commit d36706a

Please sign in to comment.