Skip to content
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

Linting with Ruff #1504

Merged
merged 12 commits into from
Oct 18, 2023
Merged

Linting with Ruff #1504

merged 12 commits into from
Oct 18, 2023

Conversation

Zeitsperre
Copy link
Collaborator

@Zeitsperre Zeitsperre commented Oct 16, 2023

Pull Request Checklist:

  • This PR addresses an already opened issue (for bug fixes / features)
    • This PR fixes #xyz
  • Tests for the changes have been added (for bug fixes / features)
    • (If applicable) Documentation has been added / updated (for bug fixes / features)
  • CHANGES.rst has been updated (with summary of main changes)
    • Link to issue (:issue:number) and pull request (:pull:number) has been added

What kind of change does this PR introduce?

  • Removed the configuration blocks in setup.cfg for pydocstyle and pycodestyle, and removed most of the checking performed by flake8 (flake8 still needed for flake8-alphabetize and flake8-rst).
  • Updated pyproject.toml with Ruff-based equivalent linting configuration
  • Updated tox.ini and Makefile to use Ruff. Reordered order of linting calls to trigger more typical violations first.
  • Updated dependencies.

Does this PR introduce a breaking change?

Yes. Ruff is now a dev dependency, while pycodestyle and pydocstyle are no longer required. The checks that were being performed by those libraries are now redundant thanks to the new configuration.

Other information:

Ruff is a linter for Python (built with Rust) that is blazingly fast and has been in development for around 1.5 years. Ruff v0.1.0 was released today.

@Zeitsperre Zeitsperre added enhancement New feature or request standards / conventions Suggestions on ways forward labels Oct 16, 2023
@Zeitsperre Zeitsperre self-assigned this Oct 16, 2023
@github-actions github-actions bot added sdba Issues concerning the sdba submodule. CI Automation and Contiunous Integration docs Improvements to documenation indicators Climate indices and indicators labels Oct 16, 2023
pyproject.toml Show resolved Hide resolved
setup.cfg Show resolved Hide resolved
@Zeitsperre
Copy link
Collaborator Author

For additional context, we still need to use flake8 until either ruff develops some new hooks or a better tool comes along that can deal with RestructuredText formatting (comoplicated) and alphabetical listings in __all__ (less complicated; see: astral-sh/ruff#1198)

@coxipi
Copy link
Contributor

coxipi commented Oct 17, 2023

Ok, I may have mixed manual and Ruff changes, you can tell me.

It doesn't seem to be much different than what we had before. Sometimes more/less white space. It seems good. I'm not sure what could go wrong with PR really, what should I be looking for. It didn't change much of our earlier formatting, so it must be working more or less equivalently.

@coxipi
Copy link
Contributor

coxipi commented Oct 18, 2023

need to remove mentions of pydocstyle in "contributing.rst" I think?

Copy link
Contributor

@coxipi coxipi left a comment

Choose a reason for hiding this comment

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

Approved!

@Zeitsperre Zeitsperre added the approved Approved for additional tests label Oct 18, 2023
@Zeitsperre Zeitsperre merged commit 960c407 into master Oct 18, 2023
16 checks passed
@Zeitsperre Zeitsperre deleted the ruff branch October 18, 2023 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved for additional tests CI Automation and Contiunous Integration docs Improvements to documenation enhancement New feature or request indicators Climate indices and indicators sdba Issues concerning the sdba submodule. standards / conventions Suggestions on ways forward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants