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

Switch to ruff format #3477

Closed
Saransh-cpp opened this issue Oct 26, 2023 · 3 comments · Fixed by #3656
Closed

Switch to ruff format #3477

Saransh-cpp opened this issue Oct 26, 2023 · 3 comments · Fixed by #3656
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours priority: medium To be resolved if time allows

Comments

@Saransh-cpp
Copy link
Member

Saransh-cpp commented Oct 26, 2023

Ruff can now format files!

Would mostly require changes in pyproject.toml and .pre-commit-config.yaml

@Saransh-cpp Saransh-cpp added difficulty: easy A good issue for someone new. Can be done in a few hours priority: medium To be resolved if time allows hacktoberfest labels Oct 26, 2023
@Rjchauhan18
Copy link
Contributor

Rjchauhan18 commented Oct 27, 2023

Hello @Saransh-cpp
Can i make PR for this ?

As mention in this issue #3476

  • Refering from this repositery if we add like this
repos:
  - repo: https://github.com/astral-sh/ruff-pre-commit
    rev: "v0.1.1"
    hooks:
      - id: ruff
        types_or: [python, pyi, jupyter]
        args: [--fix, --ignore=E741, --exclude=__init__.py]

      - id: ruff-format
        args: [--check]

Do you want it with --check or without?

  • if we add --check then it will check the files but it will not change them.

@Rjchauhan18
Copy link
Contributor

image

Hello @Saransh-cpp
Can you tell me that is this right or test is failing ?


68 files would be reformatted, 472 files left unchanged this is coming but nothing is change as i use --check in pre-commit-config.toml file. but then also

nox > Command pre-commit run --all-files failed with exit code 1
nox > Session pre-commit failed.


image

@Saransh-cpp
Copy link
Member Author

Scientific Python's guide now has instructions for ruff format - https://learn.scientific-python.org/development/guides/style/

We should follow this initially.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours priority: medium To be resolved if time allows
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants