Skip to content

Apply ruff for linting and formatting #1307

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 13 commits into from
Dec 2, 2023

Conversation

Anselmoo
Copy link
Contributor

@Anselmoo Anselmoo commented Nov 18, 2023

This pull request applies the ruff tool for linting and formatting the codebase. It includes the following commits:

  • chore: 🗑️ Fix formatting and minor issues in code → for Python Files as a preparation commit for the ruff-implementation

  • chore: 🗑️ Fix formatting and minor issues in code → for markdown as a preparation commit for the ruff-implementation

  • chore: 🗑️ Fix formatting and minor issues in code → for test-data as a preparation commit for the ruff-implementation

  • feat: ✨ Introduce ruff for linting

  • chore: ♻️ Apply new pre-commit

  • Apply fix end of files and default ruff

NOTE: Foe this PR MyPy has to be temporary deactivated and then the ruff advanced rule-set activated upon request.

Fixes: #1306

Copy link
Contributor Author

@Anselmoo Anselmoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@berquist the problem is the end of files-fix, that might be once considered in a new issue. There was some inconsistency in the length of the outputs

@berquist berquist added this to the v1.8.1 milestone Nov 28, 2023
Copy link
Member

@berquist berquist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can you make the PR starting with the pre-commit config updates that you started and I modified, then run pre-commit again? I fixed the EOF issues: pre-commit must not run on test data, only source code and docs.

  2. I'm not sure if I want to force line endings with pre-commit yet (I'd like to check some things on Windows), but we do need at least a one-time fix for everything that's here. Can you have a commit that fixes line endings separate from the one that runs ruff, then remove [fix, --lf] from the config?

@Anselmoo
Copy link
Contributor Author

@berquist

Concerning 1: Sorry, I don't totally get it? Should this PR closed and open a new one with the applied chances? Or just run it locally and resubmit possible chances?

Concerning 2: Will take a look

@berquist
Copy link
Member

berquist commented Dec 2, 2023

Sorry, this was confusing. I was asking about also fixing line endings, since we have had a problem with that.

I put back isort because ruff is not doing what I expected, and I think it's because their implementation isn't finished. However now isort has messed up some ordering that I'll need to take a closer look at.

I've reviewed all of the ruff changes and they look good.

@Anselmoo
Copy link
Contributor Author

Anselmoo commented Dec 2, 2023

Will take care of the fixing line endings; if required, I will/have to update the test in terms of counting lines. This was formally a problem in that the count of lines was not correct anymore.

@berquist
Copy link
Member

berquist commented Dec 2, 2023

I actually fixed all the line endings already (though it may come up again during PRs if someone tries to check in CRLF for Windows, we'll see).

I apologize for (re)doing lots of things here; we are, in parallel, trying to make other large developer-facing changes and publish a paper for version 2.0 in the next 1-2 months, and this needs to be merged. I tried to keep parts of your commits and add authorship where relevant. Thank you for giving the push to finally get this done.

I've installed pre-commit.ci on the repo but it won't run until the next PR.

@berquist berquist merged commit 2193e9b into cclib:master Dec 2, 2023
berquist added a commit to berquist/cclib that referenced this pull request Dec 2, 2023
@Anselmoo
Copy link
Contributor Author

Anselmoo commented Dec 2, 2023

I actually fixed all the line endings already (though it may come up again during PRs if someone tries to check in CRLF for Windows, we'll see).

I apologize for (re)doing lots of things here; we are, in parallel, trying to make other large developer-facing changes and publish a paper for version 2.0 in the next 1-2 months, and this needs to be merged. I tried to keep parts of your commits and add authorship where relevant. Thank you for giving the push to finally get this done.

I've installed pre-commit.ci on the repo but it won't run until the next PR.

No worries @berquist, if it helps, it helps ... more important keep cclib maintainable.

shivupa added a commit that referenced this pull request Dec 4, 2023
amandadumi pushed a commit to amandadumi/cclib that referenced this pull request Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ruff as universal linter for cclib
2 participants