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

Add ruff, black & isort configs #6382

Merged
merged 2 commits into from
Sep 27, 2024
Merged

Conversation

MetRonnie
Copy link
Member

@MetRonnie MetRonnie commented Sep 25, 2024

I often find myself typing out some code that wouldn't pass flake8, then hitting "format selection" or "organise imports" in VSCode. I am using isort and ruff for this (having briefly used black before ruff).

I think it would be useful to define our configs for these tools on a project level so we can agree the style and avoid unnecessary diff resulting from this going forwards.

I've chosen defaults that I think best match our current prevailing style. If we want to haggle over this, make it brief!

To illustrate, I've ruffened/blackened and isorted pathutil.py as a small example.

Check List

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • No dependency changes
  • No tests, changelog, docs needed
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

@MetRonnie MetRonnie added this to the 8.4.0 milestone Sep 25, 2024
@MetRonnie MetRonnie self-assigned this Sep 25, 2024
Copy link
Member

@wxtim wxtim left a comment

Choose a reason for hiding this comment

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

Seems reasonable.

pyproject.toml Outdated Show resolved Hide resolved
Not mandated, but for use if wanted (e.g. using "format selection" in IDEs).
Chosen defaults that best match our current style.
Copy link
Member

@oliver-sanders oliver-sanders left a comment

Choose a reason for hiding this comment

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

Should be uncontroversial as it's basically just documenting what we do already.

We should probably sync this change to other repos in time 🤷 (I too have my own local .isort config to allow me to autoformat code selections in my test editor).

@wxtim wxtim merged commit d95c306 into cylc:master Sep 27, 2024
33 checks passed
@MetRonnie MetRonnie deleted the formatting-config branch September 27, 2024 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants