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

chore: update pre-commit hooks #2313

Merged
merged 5 commits into from
Mar 19, 2023
Merged

chore: update pre-commit hooks #2313

merged 5 commits into from
Mar 19, 2023

Conversation

updates:
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.255](astral-sh/ruff-pre-commit@v0.0.254...v0.0.255)
- [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](codespell-project/codespell@v2.2.2...v2.2.4)
@pre-commit-ci pre-commit-ci bot temporarily deployed to docs-preview March 14, 2023 01:20 Inactive
@codecov
Copy link

codecov bot commented Mar 14, 2023

Codecov Report

Merging #2313 (2fe0706) into main (e316869) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files

@agoose77 agoose77 temporarily deployed to docs-preview March 17, 2023 07:23 — with GitHub Actions Inactive
@agoose77
Copy link
Collaborator

@jpivarski you might want to weigh in here; we have non-standard code style w.r.t truthiness. Do you want to relax that and let ruff clean it up, or would you prefer to instruct ruff to ignore these patterns?

@jpivarski
Copy link
Member

I really want ruff to let us avoid truthiness. I go with the flow on a lot of Python things that I'm ambivalent about, but this weak typing is pretty dangerous. If it's coupled with actually-checked type-checking, then it wouldn't be too bad. Maybe when we have enough type-hints to run MyPy and some_list always definitely refers to a list, we can replace

if some_list == []:

with

if some_list:

As long as there's a possibility that some bug would send a None, (), 0, or False here, I'd want the code to be explicit.

I put that ignore in the project-wide pyproject.toml, but there are other ruff complaints that are worth individualized noqa, such as the one where a loop variable name is overwritten to refine it (in other words, it retains the meaning, but different user-supplied types are regularized to a preferred format), it's good to have the noisiness of a noqa to point that out.

@agoose77
Copy link
Collaborator

As long as there's a possibility that some bug would send a None, (), 0, or False here, I'd want the code to be explicit.

In all, I don't mind being more ambiguous in these cases; most of the time I would err on the side of "the Programmer should understand truthiness", and checks for is None are a separate class of usage. That said, I am happy to (and indeed, already do) apply a different code style for Awkward.

Let me see which rules we need to turn on/off.

@agoose77 agoose77 enabled auto-merge (squash) March 19, 2023 15:57
@agoose77 agoose77 temporarily deployed to docs-preview March 19, 2023 16:19 — with GitHub Actions Inactive
@agoose77 agoose77 merged commit 116b6ac into main Mar 19, 2023
@agoose77 agoose77 deleted the pre-commit-ci-update-config branch March 19, 2023 16:22
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