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

Add pygrep-hooks and mdformat to pre-commit hooks #9644

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Armavica
Copy link
Contributor

@Armavica Armavica commented Oct 18, 2024

Towards #8239. This mainly addresses problems in rst and markdown files.

- [ ] Tests added
- [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst`
- [ ] New functions/methods are listed in `api.rst`
- \[ \] Closes #xxxx
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we confident this still displays correctly?

Copy link
Member

Choose a reason for hiding this comment

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

It seems to be fine, though I also find that surprising.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Indeed!

Though it seems a bit confusing since people will be directly editing it...

> [!NOTE]
This is the boolean "summarization matrix" referred to in the classic Iverson (1980, Section 4.3)\[^2\] and "nub sieve" in [various APLs](https://aplwiki.com/wiki/Nub_Sieve).

> \[!NOTE\]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here — are we sure these should be escaped? Looks like a directive (though not sure what...)


## Copyright

This document has been placed in the public domain.

## References and footnotes

[^1]: Wickham, H. (2011). The split-apply-combine strategy for data analysis. https://vita.had.co.nz/papers/plyr.html
[^2]: Iverson, K.E. (1980). Notation as a tool of thought. Commun. ACM 23, 8 (Aug. 1980), 444–465. https://doi.org/10.1145/358896.358899
\[^1\]: Wickham, H. (2011). The split-apply-combine strategy for data analysis. https://vita.had.co.nz/papers/plyr.html
Copy link
Collaborator

Choose a reason for hiding this comment

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

and here; seems unlikely this is correct

Copy link
Collaborator

Choose a reason for hiding this comment

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

A bunch of changes in this file look quite good!

@max-sixty
Copy link
Collaborator

Overall looks great!

We should check some of those, I added a couple of comments, though not a complete review.

To the extent that some might interfere with mypy or ruff, etc, that's not good — we don't want to be in a situation where code can't get through both checkers. Are we OK there?

The markdown & rst checkers look overall great!

@TomNicholas TomNicholas added the CI Continuous Integration tools label Oct 19, 2024
- repo: https://github.com/executablebooks/mdformat
rev: 0.7.18
hooks:
- id: mdformat
Copy link
Collaborator

Choose a reason for hiding this comment

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

apparently, we can fix (some of) the surprising bracket escapes with

Suggested change
- id: mdformat
- id: mdformat
additional_dependencies: [mdformat-gfm]

Copy link
Collaborator

@keewis keewis Oct 19, 2024

Choose a reason for hiding this comment

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

though I wonder if instead of using mdformat we should rely on prettier to format markdown, as that can also format json and yaml?

Copy link
Collaborator

Choose a reason for hiding this comment

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

FWIW in prql we quite successfully use prettier to format all non-core code, including yaml / json / md; would recommend: https://github.com/PRQL/prql/blob/86becc591eb1a6421695ccccdf67dd8ab5c775ec/.pre-commit-config.yaml#L18-L22

...and it has a nice VS Code extension (and I guess emacs for the pros among us...)

@headtr1ck
Copy link
Collaborator

Why don't we instead try to rely on ruff and enable these rules there?
Many seems supported already, rules start with PGH*.

@max-sixty
Copy link
Collaborator

Why don't we instead try to rely on ruff and enable these rules there? Many seems supported already, rules start with PGH*.

Definitely preferable for the python ones. (though formatting non-python files would still be part of this sort of effort...)

CORE_TEAM_GUIDE.md Show resolved Hide resolved
git pull upstream main
```

1. Add a list of contributors.
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgotten the enumeration again.

Copy link
Contributor

Choose a reason for hiding this comment

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

This is rendering fine. It's a trick to have the renderer do the numbering without having to do it manually

Copy link
Collaborator

Choose a reason for hiding this comment

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

the downside of that trick is that reading the source becomes a bit harder to read (which item from the top was that again?), so I'd prefer a linter / autoformatter to keep source and rendered version as close as possible.

Given that prettier (mirror) appears to get this right, maybe we should be using that instead? That would also auto-format yaml, css and json, and for toml we can try taplo (mirror).

2. The CI job will be started. Checks will appear in the usual dashboard panel above the comment box.
3. If more commits are added, the label checks will be grouped with the last commit checks _before_ you added the label.
4. Alternatively, you can always go to the `Actions` tab in the repo and [filter for `workflow:Benchmark`](https://github.com/scikit-image/scikit-image/actions?query=workflow%3ABenchmark). Your username will be assigned to the `actor` field, so you can also filter the results with that if you need it.
1. The CI job will be started. Checks will appear in the usual dashboard panel above the comment box.
Copy link
Contributor

Choose a reason for hiding this comment

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

Forgotten enumeration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants