Closed Huite closed 2 months ago
I'm not sure why the coverage report is way down, but I've remember seeing sudden changes in coverage reports before (e.g. flopy).
I don't think the coverage is super meaningful at the moment, though, since most of the tests don't check the answers. It's still nice to know there's no syntax errors though -- although I think ruff should catch that now.
One more thought, we could consider adding isort and formatting checks using ruff, instead of only checking linting?
One more thought, we could consider adding isort and formatting checks using ruff, instead of only checking linting?
Running ruff check takes care of this.
If I scramble the imports:
import timml as tml
import numpy as np
import matplotlib.pyplot as plt
Ruff will complain appropriately:
❯ ruff check
examples\workshop_nhv\vlaketunnel_functions.py:3:1: I001 [*] Import block is un-sorted or un-formatted
Found 1 error.
[*] 1 fixable with the `--fix` option.
It's part of the current configuration:
[tool.ruff.lint]
# See: https://docs.astral.sh/ruff/rules/
select = [
"C4", # flake8-comprehensions
"E", # pycodestyle
"F", # pyflakes
"I", # isort
"PT", # pytest-style
"D", # pydocstyle
"B", # flake8-bugbear
"NPY", # numpy
]
Sorry, i forgot import sorting is checked by ruff check
. A code formatting check (a la black) can be added with ruff format --check
? Or does ruff check
do that as well?
You're right, turns out I was a little confused...
isort is part of the linting, but the formatting isn't. To check for the formatting, we need to run ruf format --check
explicitly. I will add it to the CI.
Well, I just got confirmation from the CI that it does check:
All checks passed!
Would reformat: examples/timml_notebook0_sol.py
Would reformat: examples/workshop_nhv/vlaketunnel_functions.py
2 files would be reformatted, 31 files already formatted
Error: Process completed with exit code 1.
Turns out I had the ignore examples bit still in locally...
Well that was dumb... completely forgot this PR was already open, and went and created my own... I'm gonna merge the two and then pull that into dev.
In a nutshell:
ruff check .
now. Not sure if this replicates the current behavior (or how far that is possible with ruff).There's some funny stuff here and there, which is touched by ruff, but not everything is fixed. For example, this bit in stripareasink
changetrange
:None of these are used...? ruff has removed the assignment, but I think the lines could be deleted outright.