Specify proper language in CONTRIBUTING.md code blocks (#18605)

Signed-off-by: Peter Dave Hello <hsu@peterdavehello.org>
This commit is contained in:
Peter Dave Hello 2023-04-28 09:32:18 +08:00 committed by GitHub
parent 1bbe8c57e7
commit 010042fb92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 10 deletions

View File

@ -25,7 +25,7 @@ Follow us on Twitter at [@project_harbor][twitter]
### Fork Repository
Fork the Harbor repository on GitHub to your personal account.
```
```sh
#Set golang environment
export GOPATH=$HOME/go
mkdir -p $GOPATH/src/github.com/goharbor
@ -210,12 +210,12 @@ Note: If you split your pull request to small changes, please make sure any of t
Fork the Harbor repository and clone the code to your local workspace. Per Go's [workspace instructions](https://golang.org/doc/code.html#Workspaces), place Harbor's code on your `GOPATH`. Refer to section [Fork Repository](#fork-repository) for details.
Define a local working directory:
```
```sh
working_dir=$GOPATH/src/github.com/goharbor
```
Set user to match your github profile name:
```
```sh
user={your github profile name}
```
@ -224,7 +224,7 @@ Both `$working_dir` and `$user` are mentioned in the figure above.
### Branch
Changes should be made on your own fork in a new branch. The branch should be named `XXX-description` where XXX is the number of the issue. PR should be rebased on top of `main` without multiple branches mixed into the PR. If your PR do not merge cleanly, use commands listed below to get it up to date.
```
```sh
#goharbor is the origin upstream
cd $working_dir/harbor
@ -235,7 +235,7 @@ git rebase goharbor/main
Branch from the updated `main` branch:
```
```sh
git checkout -b my_feature main
```
@ -247,7 +247,7 @@ Try to limit column width to 120 characters for both code and markdown documents
As we are enforcing standards set by [golint](https://github.com/golang/lint), please always run golint on source code before committing your changes. If it reports an issue, in general, the preferred action is to fix the code to comply with the linter's recommendation
because golint gives suggestions according to the stylistic conventions listed in [Effective Go](https://golang.org/doc/effective_go.html) and the [CodeReviewComments](https://github.com/golang/go/wiki/CodeReviewComments).
```
```sh
#Install fgt and golint
go install golang.org/x/lint/golint@latest
@ -262,13 +262,13 @@ go list ./... | grep -v -E 'vendor|tests' | xargs -L1 fgt golint
Unit test cases should be added to cover the new code. Unit test framework for backend services is using [go testing](https://golang.org/doc/code.html#Testing). The UI library test framework is built based on [Jasmine](https://jasmine.github.io/) and [Karma](https://karma-runner.github.io/1.0/index.html), please refer to [Angular Testing](https://angular.io/guide/testing) for more details.
Run go test cases:
```
```sh
#cd #working_dir/src/[package]
go test -v ./...
```
Run UI library test cases:
```
```sh
#cd #working_dir/src/portal/lib
npm run test
```
@ -311,7 +311,7 @@ The commit message should follow the convention on [How to Write a Git Commit Me
To help write conformant commit messages, it is recommended to set up the [git-good-commit](https://github.com/tommarshall/git-good-commit) commit hook. Run this command in the Harbor repo's root directory:
```
```sh
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.6.1/hook.sh > .git/hooks/commit-msg && chmod +x .git/hooks/commit-msg
```
@ -328,7 +328,7 @@ Once your pull request has been opened, harbor will run two CI pipelines against
### Push and Create PR
When ready for review, push your branch to your fork repository on `github.com`:
```
```sh
git push --force-with-lease $user my_feature
```