Skip to content

Commit 300e5bc

Browse files
authored
docs: Explain resolving precommit + running PR checks (#224)
* docs: Add a callout that using pre-commit speeds up PR review * docs: Remove conclusion * docs: Add a section describing how to resolve failing `pre-commit` check * docs: Add a callout about approval process for PR checks * fix, docs: Don't nest callouts * fix,docs: Grammar
1 parent 6eee1c4 commit 300e5bc

File tree

1 file changed

+45
-5
lines changed

1 file changed

+45
-5
lines changed

CONTRIBUTING.md

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,17 @@ python -m pip install -r dev-requirements.txt
6464
[pre-commit](https://pre-commit.com/) is a tool that enables us to run code when committing to a local repository. We
6565
use this to automate running code formatters, linters, etc...
6666

67-
To install pre-commit in the repository, run the following from the root of the repository:
67+
To enable `pre-commit`, run the following from the root of the repository:
6868

6969
```shell
7070
pre-commit install
7171
```
7272

73-
`pre-commit` will run automatically when you commit changes, but you can also manually run it using
74-
`pre-commit run --all-files`.
73+
`pre-commit` will now automatically run a series of code quality checks when you commit changes, which
74+
will accelerate the identification of issues that will be flagged when the PR is submitted.
75+
76+
If needed, you can manually run `pre-commit` against all files with `pre-commit run --all-files`. See
77+
[the documentation for `pre-commit run`](https://pre-commit.com/#pre-commit-run) for more information.
7578

7679
Note:
7780

@@ -115,8 +118,6 @@ Note that samples are organized by scenario, find the one best-suited for your s
115118
git push -f
116119
```
117120

118-
That's it! Thank you for your contribution!
119-
120121
> [!IMPORTANT]
121122
>
122123
> You should expect to budget time to engage with reviewers (responding to comments, fixing PR checks) before your PR is merged in. This is especially
@@ -125,6 +126,45 @@ That's it! Thank you for your contribution!
125126
> Adhering to the guidance in this document (i.e [using pre-commit](#3-set-up-pre-commit), [using provided templates](#write-your-contribution)) ***will***
126127
> help expedite the review process.
127128

129+
#### Resolve Failing Pull Request Checks
130+
131+
132+
> [!IMPORTANT]
133+
>
134+
> This repository requires approval from someone with write access for pull request checks
135+
> to run against a PR, to avoid abuse of live resources.
136+
>
137+
> All of the PR checks can also be run from developers machine, which should prevent the approval
138+
> processes from unnecessarily lengthening the feedback cycle.
139+
140+
> [!NOTE]
141+
> If you are a Microsoft employee, you can skip the approval process for PR checks by:
142+
>
143+
> * Joining the "[Azure-Samples](https://github.com/Azure-Samples)" organization
144+
> * [Setting your org membership visibility to public](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership#changing-the-visibility-of-your-organization-membership)
145+
>
146+
147+
##### pre-commit
148+
149+
###### black
150+
151+
[black](https://github.com/psf/black) is a code formatter for Python and Jupyter notebooks.
152+
153+
**How to Fix**: If the `pre-commit` check is failing on your PR because of `black`, just run `pre-commit run black --all-files` and commit the changes.
154+
155+
###### nb-clean
156+
157+
[nb-clean](https://github.com/srstevenson/nb-clean) that removes metadata from Jupyter Notebooks to make them more ammenable to version control.
158+
159+
**How to Fix**: If the `nb-clean` check is failing on your PR because of `nb-clean`, just run `pre-commit run nb-clean --all-files` and commit the changes.
160+
161+
###### ruff
162+
163+
[ruff](https://github.com/astral-sh/ruff) is a linter for Python and Jupyter Notebooks.
164+
165+
**How to Fix**: If the `pre-commit` step is failing on your PR because of `ruff`:
166+
* ruff makes an attempt to automatically fix issues it detects. You can run `pre-commit run ruff --all-files` and commit any changes.
167+
* Issues that ruff can't fix should be manually updated and committed. See ruff's [rule list](https://docs.astral.sh/ruff/rules/) for more info on issues it reports.
128168

129169
### Discoverability
130170

0 commit comments

Comments
 (0)