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

ENH: Refactor code linter and formatter dependencies #144

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

jhlegarreta
Copy link
Collaborator

Refactor code linter and formatter dependencies:

  • Remove black, flake8 and isort dependencies from pyproject.toml: the role has been taken over by ruff in commit 81b3690.
  • Transfer the black and isort rules left behind to ruff in pyproject.toml
  • Remove black, flake8 and isort from the pre-commit config file and use ruff instead.

@jhlegarreta
Copy link
Collaborator Author

A few comments:

@jhlegarreta
Copy link
Collaborator Author

Also, we may want to add the --fix option and ruff format in here:

run: pipx run ruff check

so that it tells us how it would fix the code, instead of trying to discover it by ourselves.

@oesteban
Copy link
Member

Also, we may want to add the --fix option and ruff format in here:

run: pipx run ruff check

so that it tells us how it would fix the code, instead of trying to discover it by ourselves.

I don't think we would see how to fix the code unless we do a git diff right after, but I'm happy to do that.

@oesteban
Copy link
Member

Oh, I see, this is not the github action, it's pre-commit.

I personally would prefer to avoid pre-commit. But it is not a hill I intend to die on.

Refactor code linter and formatter dependencies:
- Remove `black`, `flake8` and `isort` dependencies from
  `pyproject.toml`: the role has been taken over by `ruff` in commit
  81b3690.
- Transfer the `black` and `isort` rules left behind to `ruff` in
  `pyproject.toml`
- Remove `black`, `flake8` and `isort` from the pre-commit config file
  and use `ruff` instead.

Set explicitly `eddymotion` as the known first party so that the
`import` statements corresponding to `eddymotion` are separated by a
blank line from third-party package `import` statements.

Add `--diff` to the `ruff check` command in the contribution checks
GitHub Actions workflow so that the differences that need to be applied
are actually shown on GitHub.
@jhlegarreta
Copy link
Collaborator Author

Oh, yes, looks like meant more a diff-like thing than a fix for GHA, and the pre-commit config is probably only checking the modified files, and thus we are not seeing locally what the GHA is reporting.

I fixed the issues in the last push-force. In a separate PR I will bring the ruff formater changes to the whole code (only a few changes are reported).

@oesteban
Copy link
Member

Outstanding work - thanks!

@oesteban oesteban merged commit 8b29477 into nipreps:main Mar 28, 2024
7 checks passed
@jhlegarreta jhlegarreta deleted the RefactorLinterFormatterDeps branch March 28, 2024 15:45
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.

2 participants