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

gh-231: add ruff linting to pre-commit #232

Merged
merged 34 commits into from
Sep 19, 2024
Merged

gh-231: add ruff linting to pre-commit #232

merged 34 commits into from
Sep 19, 2024

Conversation

paddyroddy
Copy link
Member

@paddyroddy paddyroddy commented Sep 17, 2024

Add ruff linting and turn on as many rules as possible. However, I will turn off many and not spend too much time fixing them. In a perfect world, we will try and fix as many of these as possible - as they will generally help with maintenance in the long term.

Closes: #231
Refs: #170

@paddyroddy paddyroddy added enhancement New feature or request infrastructure Project infrastructure: dev tools, packaging, etc. labels Sep 17, 2024
@paddyroddy paddyroddy self-assigned this Sep 17, 2024
glass/lensing.py Outdated Show resolved Hide resolved
@@ -2,3 +2,4 @@
b42067f6776dcd763827000d585a88e071b78af3
# applied prettier - https://github.com/glass-dev/glass/pull/227
f9bac62f497a7288aa71fd4dbd948945c37f854e
# applied ruff-linting - https://github.com/glass-dev/glass/pull/232
Copy link
Member Author

Choose a reason for hiding this comment

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

@Saransh-cpp when this is merged can you add the commit hash underneath?

Copy link
Member

Choose a reason for hiding this comment

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

🫡

Comment on lines +98 to +109
"ANN001", # TODO: missing-type-function-argument
"ANN002", # TODO: missing-type-args
"ANN003", # TODO: missing-type-kwargs
"ANN201", # TODO: missing-return-type-undocumented-public-function
"COM812", # missing-trailing-comma (ruff-format recommended)
"D203", # one-blank-line-before-class
"D212", # blank-line-before-class
"ERA001", # TODO: commented-out-code
"ISC001", # single-line-implicit-string-concatenation (ruff-format recommended)
"NPY002", # TODO: numpy-legacy-random
"NPY201", # TODO: numpy2-deprecation
"RUF003", # ambiguous-unicode-character-comment
Copy link
Member Author

@paddyroddy paddyroddy Sep 18, 2024

Choose a reason for hiding this comment

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

All the TODO can gradually be fixed, not doing now for the sake of time

Copy link
Member Author

Choose a reason for hiding this comment

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

@paddyroddy
Copy link
Member Author

Okay, this is ready, always fiddly to add this kind of thing! Please review carefully as there are a fair few changes. They are generally trivial. I have self-reviewed and everything looks fine, I think. Have raised #248, #249 to follow up. This should probably me merged ASAP as other PRs will conflict with this potentially - and a fair bit of effort to fix.

@paddyroddy paddyroddy marked this pull request as ready for review September 18, 2024 16:20
Copy link
Collaborator

@ntessore ntessore left a comment

Choose a reason for hiding this comment

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

Amazing piece of work! Had a quick look and other than the headings I think everything is a matter of taste.

glass/core/__init__.py Outdated Show resolved Hide resolved
glass/core/array.py Outdated Show resolved Hide resolved
glass/lensing.py Outdated Show resolved Hide resolved
glass/observations.py Show resolved Hide resolved
glass/shells.py Outdated Show resolved Hide resolved
glass/user.py Outdated Show resolved Hide resolved
tests/test_galaxies.py Outdated Show resolved Hide resolved
Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Taking over 🫡

.pre-commit-config.yaml Show resolved Hide resolved
glass/core/__init__.py Outdated Show resolved Hide resolved
glass/core/array.py Outdated Show resolved Hide resolved
glass/fields.py Outdated Show resolved Hide resolved
glass/galaxies.py Outdated Show resolved Hide resolved
glass/points.py Outdated Show resolved Hide resolved
glass/shapes.py Outdated Show resolved Hide resolved
glass/shells.py Outdated Show resolved Hide resolved
glass/user.py Outdated Show resolved Hide resolved
glass/user.py Outdated Show resolved Hide resolved
@Saransh-cpp
Copy link
Member

This should be ready to review again!

Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Amazing work, thanks! Looks good to me. I'll merge after the mean/mode confusion is cleared.

Copy link
Collaborator

@ntessore ntessore left a comment

Choose a reason for hiding this comment

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

Excellent work @paddyroddy and @Saransh-cpp!

@Saransh-cpp Saransh-cpp merged commit e58d861 into main Sep 19, 2024
12 checks passed
@Saransh-cpp Saransh-cpp deleted the paddy/ruff-lint branch September 19, 2024 15:36
@paddyroddy
Copy link
Member Author

Thanks for taking over whilst I was away @Saransh-cpp!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request infrastructure Project infrastructure: dev tools, packaging, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ruff linting
3 participants