Skip to content

Enforce Repo-Review rules #2075

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

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,12 @@ repos:
- pytest
# Zarr v2
- types-redis
- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review
Comment on lines +42 to +45
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- repo: https://github.com/scientific-python/cookie
rev: 2024.04.23
hooks:
- id: sp-repo-review
- repo: https://github.com/scientific-python/repo-review
rev: 0.11
hooks:
- id: repo-review

I think better to use the repo-review repository itself?

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Aug 11, 2024

Choose a reason for hiding this comment

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

I understand sp-repo-review/cookie should be used to evaluate repos against the guidelines in the Scientific Python Library Development Guide. The repo-review framework has sp-repo-review and validate-pyproject plugins.

The repo-review documentation suggests we should directly use the plugin we're interested in:

Pre-commit

You can also use this from pre-commit:

- repo: https://github.com/scientific-python/repo-review
  rev: <version>
  hooks:
    - id: repo-review
      additional_dependencies: ["repo-review[cli]", "sp-repo-review==<version>"]

(Insert the current version above, and ideally pin the plugin version, as long as you have a way to auto-update it.)

Though check your favorite plugin, which might directly support running from pre-commit, and then pre-commit’s pinning system will pin on your plugin, rather than the framework (repo-review).

Copy link
Contributor

Choose a reason for hiding this comment

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

In that example they use https://github.com/scientific-python/repo-review instead of https://github.com/scientific-python/cookie, so I think it's best to change it from cookie to repo-review?

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Sep 2, 2024

Choose a reason for hiding this comment

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

It depends on who applied the relevant commit. Let me investigate.

Copy link
Contributor Author

@DimitriPapadopoulos DimitriPapadopoulos Sep 2, 2024

Choose a reason for hiding this comment

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

It goes on with:

⚠ Warning

This currently has a couple of weird quirks. Pre-commit will not report the correct version for repo-review (it’s always 0.1), and it will lose the cli requirements if you add additional dependencies (which you always do, it’s a plugin framework, so it needs plugins). To counter this, plugins can avoid lower bounds and you can manually add repo-review[cli], as seen above, or plugins can provide their own hooks (like sp-repo-review also does).

In the future, a mirror will be set up so that we can avoid these issues.

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,9 @@ filterwarnings = [
markers = [
"gpu: mark a test as requiring CuPy and GPU"
]

[tool.repo-review]
ignore = [
"PC111", # fix Python code in documentation - enable later
"PC180", # for JavaScript - not interested
]