Skip to content

Lint library code only with ruff check #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Feb 3, 2025

Conversation

roryyorke
Copy link
Contributor

Make library code ruff check clean for pyflakes ("F" code) warnings, and checks this in a Github Action.

"Library code" is all non-test code in control/, so excludes tests, examples, and benchmarks. Making all of those ruff-check-clean too will take some time, and be a big change, so it seems worth getting this in first. This also gives an opportunity for reviewing the ruff configuration, and the overall approach, e.g., disabling import checks in __init__.py.

Besides making the other parts of the code pass lint, ruff can do more, and we can look at adding more checks later.

Partially addresses gh-1101.

You can see an example of a failing Github Action ruff check here.

@coveralls
Copy link

coveralls commented Feb 2, 2025

Coverage Status

coverage: 94.667% (+0.006%) from 94.661%
when pulling 18d3d59 on roryyorke:lint-lib-only
into d2f9a9c on python-control:main.

@roryyorke
Copy link
Contributor Author

roryyorke commented Feb 2, 2025

failure in "Conda-based pytest / Py3.12; conda Slycot; conda Pandas; conda CVXOPT ; QtAgg", in step Install optional dependencies. Seem to be getting these often.

possibly relevant parts there:

warning  libmamba Could not parse mod/etag header
error    libmamba Error when extracting package: Could not stat info/recipe/parent/install-libstdc++-devel.sh
libgfortran-ng-14.2.0-h69a702a_1.conda extraction failed
Found incorrect download: libgfortran-ng. Aborting

@murrayrm
Copy link
Member

murrayrm commented Feb 2, 2025

Thanks for putting this together @roryyorke!

These changes look good to me. I'll hold on merging in case others want to take a look, but will plan on merging in the next day or two.

I'll create an issue to discuss the sporadically failing CI tests. Very annoying to have to re-run them and it seems to be increasing in frequency.

@murrayrm murrayrm merged commit 1fc2c2d into python-control:main Feb 3, 2025
24 checks passed
@murrayrm murrayrm linked an issue Feb 3, 2025 that may be closed by this pull request
@murrayrm murrayrm added this to the 0.10.2 milestone Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyflakes (pylint, ruff, ....) clean-up, CI?
3 participants