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

Use ruff as linter and formatter #2765

Merged

Conversation

ringohoffman
Copy link
Contributor

@ringohoffman ringohoffman commented Jan 15, 2024

Alternative to #2754 based on @brentyi's suggestion: #2754 (comment)

Upgrade ruff and use ruff format ... as a drop in replacement for black: https://docs.astral.sh/ruff/formatter/

Also use ruff check ... --fix as a drop in replacement for isort (produces identical results as using the following isort config):

[tool.isort]
combine_as_imports = true
line_length = 120
known_first_party = ["nerfstudio"]
profile = "black"

Update pre-commit hooks, VS Code settings.json, and CI steps.

BTW you may need to run pre-commit autoupdate or clear your cache in order to start using the new ruff hooks.

@ringohoffman ringohoffman force-pushed the use-ruff-as-linter-and-formatter branch from 619cdfc to a962fa6 Compare January 15, 2024 06:39
@ringohoffman ringohoffman marked this pull request as draft January 15, 2024 07:24
@ringohoffman ringohoffman marked this pull request as ready for review January 15, 2024 07:46
@ringohoffman
Copy link
Contributor Author

I was worried that the ruff-format pre-commit hook somehow missed the files in my last commit, but I think ruff check and ruff format just happened to affect 2 mutually exclusive groups of files.

@brentyi
Copy link
Collaborator

brentyi commented Jan 15, 2024

Looks good to me! @tancik any opposition to moving away from black?

@tancik
Copy link
Contributor

tancik commented Jan 15, 2024

None from me

@brentyi brentyi merged commit f0aadf9 into nerfstudio-project:main Jan 15, 2024
4 checks passed
@ringohoffman ringohoffman deleted the use-ruff-as-linter-and-formatter branch January 15, 2024 21:53
@brentyi
Copy link
Collaborator

brentyi commented Jan 15, 2024

Thanks @ringohoffman!!

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.

3 participants