Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

add PR guideline, update CONTRIBUTING.md, move spellcheck #5390

Closed
wants to merge 8 commits into from

Conversation

drahnr
Copy link
Contributor

@drahnr drahnr commented Apr 25, 2022

Formalize a rough outline of what contributors should look out for. This is the first attempt to do so and provide some convenience, especially around referencing companion PRs, which I tend to forget every single time I need them.

@drahnr drahnr requested review from a team and chevdor as code owners April 25, 2022 15:46
@github-actions github-actions bot added the A0-please_review Pull request needs code review. label Apr 25, 2022
- [ ] Workspace compiles `cargo build --workspace`?
- [ ] Workspace tests `cargo test --workspace`?
- [ ] Applied `cargo +nightly fmt` with the version from CI?
- [ ] Ran `cargo spellcheck` without any fallout? If any, update `.spellcheck/lingua.dic`.
Copy link
Member

Choose a reason for hiding this comment

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

Is the full command

spellcheck check -cfg=.spellcheck/spellcheck.toml --checkers hunspell

or is list-files required first for optimization? Would be nice to include instructions how to update the dictionary exactly or a link to that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's on my todo to print those instructions from cargo-spellcheck directly, covered by drahnr/cargo-spellcheck#193 and planned to be done thisweek™


- [ ] Labels applied correctly? See the [contributing guidlines](../CONTRIBUTING.md).
- [ ] Workspace compiles `cargo build --workspace`?
- [ ] Workspace tests `cargo test --workspace`?
Copy link
Member

Choose a reason for hiding this comment

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

That might be to heavy for some external contributors' laptops to handle ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

it's being executed by CI, why bother doing it locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the turnaround time is significantly faster doing it locally iff your local machine can handle it :)

Copy link
Contributor Author

@drahnr drahnr Apr 26, 2022

Choose a reason for hiding this comment

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

Added additional indentation to make sure it's optional and stated that explicitly.

@@ -273,7 +273,7 @@ spellcheck:
- git fetch origin +${CI_DEFAULT_BRANCH}:${CI_DEFAULT_BRANCH}
- echo "___Spellcheck is going to check your diff___"
- cargo spellcheck list-files -vvv $(git diff --diff-filter=AM --name-only $(git merge-base ${CI_COMMIT_SHA} ${CI_DEFAULT_BRANCH} -- :^bridges))
- time cargo spellcheck check -vvv --cfg=scripts/gitlab/spellcheck.toml --checkers hunspell --code 1
- time cargo spellcheck check -vvv --cfg=.spellcheck/spellcheck.toml --checkers hunspell --code 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it necessary to move this file to the .spellcheck folder? Recently we unified the structure of CI files in all major repos (https://github.com/paritytech/ci_cd/issues/313) and would like to keep all files in one place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I was opposing the change to move them out of there from the get go, since that's the default discovery location of cargo-spellcheck and avoids yet another arg required.

Copy link
Contributor

Choose a reason for hiding this comment

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

arg is not that bad, but what if someone wants several config files for the different crates, dirs, and languages?

Copy link
Contributor

Choose a reason for hiding this comment

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

btw you still use the extra arg here

Copy link
Contributor Author

@drahnr drahnr Apr 26, 2022

Choose a reason for hiding this comment

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

Yes, I use the extra arg here for explicitness. But for the average user I'd not want that. If the file does not reside in the default lookup dir, the contributor sees an excessive amount of detected errors, that are covered by lingua.dic.

Comment on lines 18 to 21
- [ ] Workspace compiles `cargo check --workspace --tests`?
- [ ] Workspace tests `cargo test --workspace`?
- [ ] Applied `cargo +nightly fmt` with the version from CI?
- [ ] Ran `cargo spellcheck` without any fallout? If any, update `.spellcheck/lingua.dic`.
Copy link
Member

Choose a reason for hiding this comment

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

All that is ensured by the CI, not sure why this needs to be mentioned here.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 @bkchr

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think, guidance on how to please the CI is a generally good and nice thing to state in a PR. The above might indeed be too verbose, but i.e. cargo-spellcheck and cargo fmt are something that wasn't covered before, but we only point to a style guide that is not so accurate anymore.

Copy link
Contributor

@sandreim sandreim Apr 26, 2022

Choose a reason for hiding this comment

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

I think, guidance on how to please the CI is a generally good and nice thing to state in a PR. The above might indeed be too verbose, but i.e. cargo-spellcheck and cargo fmt are something that wasn't covered before, but we only point to a style guide that is not so accurate anymore.

I tend to agree this is a bit redundant and just a checklist to fill by hand once you contribute a few times, but for first time contributors, it's really good to have this information ahead of time and not wonder through the CI errors to figure out what can be wrong for such common issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can remove the checklist property and just make it a list of things to cover.

Copy link
Member

Choose a reason for hiding this comment

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

Can we not just put this into the CONTRIBUTING.md?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, works as well

@@ -8,7 +8,10 @@ There are a few basic ground-rules for contributors (including the maintainer(s)
- **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work.
- **All modifications** must be made in a **pull-request** to solicit feedback from other contributors.
- A pull-request _must not be merged until CI_ has finished successfully.
- Contributors should adhere to the [house coding style](https://github.com/paritytech/polkadot/wiki/Style-Guide).
- Contributors should apply `cargo +nightly fmt` with the version used in CI.
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
- Contributors should apply `cargo +nightly fmt` with the version used in CI.
- Contributors must apply `cargo +nightly fmt` with the version used in CI.

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
- Contributors should apply `cargo +nightly fmt` with the version used in CI.
- Contributors should apply `cargo +nightly fmt` with the version used in CI (up-to-date CI image: `paritytech/ci-linux:production`).

Copy link
Contributor

Choose a reason for hiding this comment

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

but still, no need in this step as it's done by CI anyway

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was under the impression we could use the rust-toolchain file for specifying the the supported toolchain rather than pulling in the whole container env, but it seems it only supports a single rust version reference and being unspecific regarding the tool rust-lang/rustup#1172


- [ ] Labels applied correctly? See the [contributing guidlines](../CONTRIBUTING.md).
- [ ] Workspace compiles `cargo build --workspace`?
- [ ] Workspace tests `cargo test --workspace`?
Copy link
Contributor

Choose a reason for hiding this comment

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

it's being executed by CI, why bother doing it locally?

Comment on lines 18 to 21
- [ ] Workspace compiles `cargo check --workspace --tests`?
- [ ] Workspace tests `cargo test --workspace`?
- [ ] Applied `cargo +nightly fmt` with the version from CI?
- [ ] Ran `cargo spellcheck` without any fallout? If any, update `.spellcheck/lingua.dic`.
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 @bkchr

@@ -273,7 +273,7 @@ spellcheck:
- git fetch origin +${CI_DEFAULT_BRANCH}:${CI_DEFAULT_BRANCH}
- echo "___Spellcheck is going to check your diff___"
- cargo spellcheck list-files -vvv $(git diff --diff-filter=AM --name-only $(git merge-base ${CI_COMMIT_SHA} ${CI_DEFAULT_BRANCH} -- :^bridges))
- time cargo spellcheck check -vvv --cfg=scripts/gitlab/spellcheck.toml --checkers hunspell --code 1
- time cargo spellcheck check -vvv --cfg=.spellcheck/spellcheck.toml --checkers hunspell --code 1
Copy link
Contributor

Choose a reason for hiding this comment

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

btw you still use the extra arg here

@@ -8,7 +8,10 @@ There are a few basic ground-rules for contributors (including the maintainer(s)
- **Non-master branches**, prefixed with a short name moniker (e.g. `gav-my-feature`) must be used for ongoing work.
- **All modifications** must be made in a **pull-request** to solicit feedback from other contributors.
- A pull-request _must not be merged until CI_ has finished successfully.
- Contributors should adhere to the [house coding style](https://github.com/paritytech/polkadot/wiki/Style-Guide).
- Contributors should apply `cargo +nightly fmt` with the version used in CI.
Copy link
Contributor

Choose a reason for hiding this comment

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

but still, no need in this step as it's done by CI anyway

@drahnr
Copy link
Contributor Author

drahnr commented Apr 26, 2022

Just to clarify the intent of this PR:

It's supposed to give both people being onboarded as well as external contributors a minimal guide how to pass the CI hurdle.

That said, we might shift the more detailed instructions to the CONTRIBUTING.md, my point being, that it must be as easy to discover as possible :)


## Checklist

- [ ] Labels applied correctly? See the [contributing guidlines](../CONTRIBUTING.md).
Copy link
Contributor

Choose a reason for hiding this comment

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

External contributors cannot apply labels.

<!--
## Companions:

Must be last!
Copy link
Contributor

Choose a reason for hiding this comment

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

Why though? And is the contributor supposed remove the comment? Otherwise, it won't be last due to the -->


<!--
Apply labels!
-->
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks a bit too much imperative... also I feel it might be not clear to a new contributor what exactly he should do here.

The item in the checklist helps, but why do we need this comment here then?


Fixes #
Ref #
-->
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel that an external contributor may not be fully clear on what this is. I feel that this should be full sentences. Maybe something along those lines:

"Hello and thank you for the pull request.

Please leave a crisp summary of the issue that you are solving with the issues linked that describe the issue itself".

I don't think we should strive for brevity here. The reason is, a user to developer will probably skip the static prompt part. I can guarantee that this will be an automatic action for most people. They won't even notice it after a while.

On the other hand, a newcomer may appreciate if you write in the expanded form right away.

### Helping out

We use labels to manage PRs and issues and communicate state of a PR. Please familiarize yourself with them. Furthermore we are organizing issues in milestones. Best way to get started is to a pick a ticket from the current milestone tagged easy or medium and get going or mentor and get in contact with the mentor offering their support on that larger task.
Issues
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
Issues
Issues

@@ -33,6 +36,21 @@ When reviewing a pull request, the end-goal is to suggest useful changes to the
- There exists a somewhat cleaner/better/faster way of accomplishing the same feature/fix.
- It does not fit well with some other contributors' longer-term vision for the project.

### Helping out

We use labels to manage PRs and issues and communicate state of a PR. Please familiarize yourself with them. Furthermore we are organizing issues in milestones. Best way to get started is to a pick a ticket from the current milestone tagged easy or medium and get going or mentor and get in contact with the mentor offering their support on that larger task.
Copy link
Contributor

Choose a reason for hiding this comment

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

We could also provide quick links to those task queries to reduce friction a bit for a potential contributor.

We use labels to manage PRs and issues and communicate state of a PR. Please familiarize yourself with them. Furthermore we are organizing issues in milestones. Best way to get started is to a pick a ticket from the current milestone tagged easy or medium and get going or mentor and get in contact with the mentor offering their support on that larger task.
Issues

Please label issues with the following labels:
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
Please label issues with the following labels:
Issues must be labelled with the following labels:

I am suggesting this to not confuse the readers. Right now it reads as if we are asking the new contributors to help label issues.

Ideally, we don't accept this change but just move this guidance elsewhere.

## Consequences

<!-- What becomes easier or more difficult to do because of this change? -->
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this something that was discussed somewhere already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed in what regard? We need a form of documenting far reaching implementation choices.

Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like quite a significant change for the existing workflow. Thus I would expect a discussion to happen regarding it. At the same time, I have missed quite some of the parachains calls. So I thought maybe I could catch up with that or get a gist of that discussion somewhere.

Copy link
Member

@bkchr bkchr May 13, 2022

Choose a reason for hiding this comment

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

This repo is also not just about parachains. I don't have seen any discussion about this change somewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intent was mostly to guide people, and the ADR is something that's an approach to document things and reduce the tribal knowledge on why things are as they are.

@drahnr drahnr self-assigned this Apr 29, 2022
@drahnr
Copy link
Contributor Author

drahnr commented May 16, 2022

Closing, partially since the spellcheck changes are not needed (forgot the reference from the manfiest is also there) and the remaining topics will be split into individual items.

@drahnr drahnr closed this May 16, 2022
@bkchr bkchr deleted the bernhard-contrib branch May 16, 2022 07:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants