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

[Refine] refine contributing.md #1941

Merged
merged 38 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
0004627
refaictor CONTRIBUDING.MD
HAOCHENYE May 8, 2022
157be86
refaictor CONTRIBUDING.MD
HAOCHENYE May 8, 2022
c30bd98
fix source rvm shell command
HAOCHENYE May 8, 2022
b970b36
merge main
HAOCHENYE May 23, 2022
f649bc7
fix lint
HAOCHENYE May 23, 2022
6b18e6b
add chinese contributing.md
HAOCHENYE Jun 15, 2022
e6f14af
fix error render
HAOCHENYE Jun 15, 2022
d75b5dc
fix error render
HAOCHENYE Jun 15, 2022
a9357a8
refine description
HAOCHENYE Jun 15, 2022
ae650b9
refine description
HAOCHENYE Jun 15, 2022
615387b
minor refine
HAOCHENYE Jun 30, 2022
fc57e7c
install ffmpeg before ut
HAOCHENYE Jun 30, 2022
91d874b
Merge branch 'master' into HAOCHENYE/refine_contributing.md
HAOCHENYE Nov 13, 2022
04c7940
Minor retfine
HAOCHENYE Nov 13, 2022
1dff4d6
Minor refine
HAOCHENYE Nov 13, 2022
b28489b
Merge branch 'master' of github.com:open-mmlab/mmcv into HAOCHENYE/re…
HAOCHENYE Nov 16, 2022
f7b2184
refine chinese contributing.md
HAOCHENYE Nov 16, 2022
4596a1d
Refine
HAOCHENYE Nov 16, 2022
088f646
Fix as comment
HAOCHENYE Nov 16, 2022
c08f4f0
Fix as comment
HAOCHENYE Nov 16, 2022
25e0f39
restore pr.md
HAOCHENYE Nov 16, 2022
c6ede20
minor refine
HAOCHENYE Nov 16, 2022
c27ff8e
minor refine
HAOCHENYE Nov 16, 2022
b72abd8
update chinese CONTRIBUTING.md in root dir
HAOCHENYE Nov 16, 2022
70b7e00
adjust imgae size
HAOCHENYE Nov 17, 2022
23f5e26
update en CONTRIBUTING.md
HAOCHENYE Nov 17, 2022
6c78a8c
update en CONTRIBUTING.md
HAOCHENYE Nov 17, 2022
7991634
update contributing.md in docs
HAOCHENYE Nov 17, 2022
b0306be
restore change of index.rst
HAOCHENYE Nov 17, 2022
05b26cb
Fix as comment
HAOCHENYE Nov 17, 2022
0dfce37
minor refine
HAOCHENYE Nov 18, 2022
6a91ebd
remove content in PR.md
HAOCHENYE Nov 18, 2022
bb572c4
minor refine
HAOCHENYE Nov 18, 2022
353ee3b
minor refine
HAOCHENYE Nov 18, 2022
f830e56
minor refine
HAOCHENYE Nov 18, 2022
68fe606
Fix as comment
HAOCHENYE Nov 18, 2022
3016300
rename
HAOCHENYE Nov 18, 2022
dbd63c4
minor refine
HAOCHENYE Nov 18, 2022
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
154 changes: 132 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,143 @@ All kinds of contributions are welcome, including but not limited to the followi
- Add documentation or translate the documentation into other languages
- Add new features and components

> If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.

### Workflow

1. fork and pull the latest OpenMMLab repository
2. checkout a new branch (do not use master branch for PRs)
3. commit your changes
4. create a PR
**step1: fork**

Fork and pull the latest OpenMMLab repository
![image](https://user-images.githubusercontent.com/57566630/167305749-43c7f4e9-449b-4e98-ade5-0c9276d5c9ce.png)

```shell
git clone https://github.com/{username}/mmcv.git
cd mmcv
git remote add upstream git@github.com:open-mmlab/mmcv.git
```

**step2: prepare pre-commit**

Configure pre-commit for the first time

After you clone the repository, you need to initialize the pre-commit hook.

```shell
pip install -U pre-commit
pre-commit install
```

After this on every commit check code linters and formatter will be enforced.

> Before you create a PR, make sure that your code lints and is formatted by yapf.

Check whether pre-commit has been configured successfully:

```shell
pre-commit run --all-files
```

> For Chinese users, if you are stuck in the above command, you can temporarily replace `.pre-commit-config.yaml` with `.pre-commit-config-zh-cn.yaml`. After all pre-commit hooks have been installed, and then replace it back.

**pre-commit failed**(some code will be fixed automatically)

![image](https://user-images.githubusercontent.com/57566630/167306461-3cb3b5bf-d9b3-4d5a-9c0a-34cfded8dbbc.png)

**pre-commit success**

![image](https://user-images.githubusercontent.com/57566630/167306496-d2b8daf7-d72c-4129-a0e8-175f8a32cc47.png)

If you are bothered by pre-commit when commit temporally change, you can commit your change with `--no-verify`

```shell
git commit -m "xxx" --no-verify
```

3. Checkout a new branch (do not use master branch for PRs)

It is recommended to name your branch with 'username/pr_name'

```shell
git checkout -b username/{pr_name}
```

4. Make changes and add unit test if necessary

If your pr add some features or affect the logic of the previous implementation, a corresponding unit test should be added to the directory `tests`.

5. Pass corresponding unit test.

Your changes should pass through the corresponding unit test at lest. For example, you make some changes in `mmcv/runner/epoch_based_runner.py`, then you should:

```{note}
If you plan to add some new features that involve large changes, it is encouraged to open an issue for discussion first.
```shell
pytest tests/test_runner/test_runner.py
```

6. Commit your changes

Make sure your changes pass through pre-commit.

```bash
# coding
git add [files]
git commit -m 'messages'
```

7. push your code to remote

```shell
git push -u upstream {branch_name}
```

8. Create a PR

(What is PR? See definition [here](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests))

(1). Create a PR on github:
![image](https://user-images.githubusercontent.com/57566630/201533288-516f7ac4-0b14-4dc8-afbd-912475c368b5.png)

(2). Revise PR message template to describe your motivation and modifications made in this PR.

![image](https://user-images.githubusercontent.com/57566630/201533716-aa2a2c30-e3e7-489c-998b-6723f92e2328.png)

The PR tile should starts with the following prefix:

- \[Feature\]: add new feature
- \[Fix\] Fix bug
- \[Docs\] Related to documents
- \[WIP\] In developing(which will not be reviewed temporarily)

The PR description should introduce main changes, results and influences on other modules in short description, and associate related issues and pull requests with a milestone. You can also link the related issue to the PR manually in the PR message (For more information, checkout the
[official guidance](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)).

```{note}
1. One short-time branch should be matched with only one PR. A single-function PR is more likely to be merged.

2. Accomplish a detailed change in one PR. Avoid large PR

Bad: Support Faster R-CNN
Acceptable: Add a box head to Faster R-CNN
Good: Add a parameter to box head to support custom conv-layer number
```

(3). After creating a PR, if you create for the first time, CLA should be assigned
![image](https://user-images.githubusercontent.com/57566630/167307569-a794b967-6e28-4eac-a942-00deb657815f.png)

(4). Consider CI/CD will build mmcv in different platform, you can check your building status in:
![image](https://user-images.githubusercontent.com/57566630/167307490-f9ebf9fa-63c0-4d83-8ba1-081ea169eb3a.png). You'll find the detail error information by clicking the `Details`

9. Resolve conflicts

Sometimes your modification may conflict with the latest code of the master branch. You can resolve the conflict by the following steps:

```shell
git fetch --all --prune
git merge upstream/master
git push
```

We use `merge` rather than `rebase` here since it will produce less conflicts. If you are very confident in conflict-handling skills, we strongly recommend using rebase to maintain a linear commit history.

### Code style

#### Python
Expand All @@ -38,22 +164,6 @@ We use [pre-commit hook](https://pre-commit.com/) that checks and formats for `f
fixes `end-of-files`, `double-quoted-strings`, `python-encoding-pragma`, `mixed-line-ending`, sorts `requirments.txt` automatically on every commit.
The config for a pre-commit hook is stored in [.pre-commit-config](./.pre-commit-config.yaml).

After you clone the repository, you will need to install initialize pre-commit hook.

```shell
pip install -U pre-commit
```

From the repository folder

```shell
pre-commit install
```

After this on every commit check code linters and formatter will be enforced.

> Before you create a PR, make sure that your code lints and is formatted by yapf.

#### C++ and CUDA

We follow the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html).
114 changes: 0 additions & 114 deletions docs/en/community/pr.md

This file was deleted.

1 change: 0 additions & 1 deletion docs/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ You can switch between Chinese and English documents in the lower-left corner of
:caption: Community

community/contributing.md
community/pr.md

.. toctree::
:maxdepth: 2
Expand Down
Loading