CONTRIBUTING.md 6.02 KB
Newer Older
David Kaltschmidt's avatar
David Kaltschmidt committed
1
2
3
4
5
# Contributing

Grafana uses GitHub to manage contributions.
Contributions take the form of pull requests that will be reviewed by the core team.

6
- If you are a new contributor see: [Steps to Contribute](#steps-to-contribute)
David Kaltschmidt's avatar
David Kaltschmidt committed
7

8
- If you have a trivial fix or improvement, go ahead and create a pull request.
David Kaltschmidt's avatar
David Kaltschmidt committed
9

10
- If you plan to do something more involved, discuss your idea on the respective [issue](https://github.com/grafana/grafana/issues) or create a [new issue](https://github.com/grafana/grafana/issues/new) if it does not exist. This will avoid unnecessary work and surely give you and us a good deal of inspiration.
David Kaltschmidt's avatar
David Kaltschmidt committed
11

12
- Sign our [CLA](http://docs.grafana.org/contribute/cla/).
bergquist's avatar
bergquist committed
13

14
15
16
- Make sure to follow the code style guides
  - [Backend](https://github.com/grafana/grafana/tree/master/pkg)
  - [Frontend](https://github.com/grafana/grafana/tree/master/style_guides)
David Kaltschmidt's avatar
David Kaltschmidt committed
17
18
19
20
21

## Steps to Contribute

Should you wish to work on a GitHub issue, check first if it is not already assigned to someone. If it is free, you claim it by commenting on the issue that you want to work on it. This is to prevent duplicated efforts from contributors on the same issue.

22
23
24
25
Please check the [`beginner friendly`](https://github.com/grafana/grafana/issues?q=is%3Aopen+is%3Aissue+label%3A%22beginner+friendly%22) and [`help wanted`](https://github.com/grafana/grafana/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22) labels to find issues that are good for getting started. If you have questions about one of the issues, with or without the tag, please comment on them and one of the core team or the original poster will clarify it.

To setup a local development environment we recommend reading [Building Grafana from source](http://docs.grafana.org/project/building_from_source/)

David Kaltschmidt's avatar
David Kaltschmidt committed
26
27
## Pull Request Checklist

28
- Branch from the master branch and, if needed, rebase to the current master branch before submitting your pull request. If it doesn't merge cleanly with master you may be asked to rebase your changes.
29

30
- If your patch is not getting reviewed or you need a specific person to review it, you can @-reply a reviewer asking for a review in the pull request or a comment.
31

32
- Add tests relevant to the fixed bug or new feature.
33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
### High level checks

- [ ] The pull request adds value and the impact of the change is in line with [Backend](https://github.com/grafana/grafana/tree/master/pkg) or [Frontend](https://github.com/grafana/grafana/tree/master/style_guides).
- [ ] The pull request works the way it says it should do.
- [ ] The pull request closes one issue if possible and does not fix unrelated issues within the same pull request.
- [ ] The pull request contains necessary tests.

### Low level checks

- [ ] The pull request contains a title that explains it. It follows [PR and commit messages guidelines](#Pull-Requests-titles-and-message)
- [ ] The pull request contains necessary link(s) to issue(s). 
- [ ] The pull request contains commits with messages that are small and understandable. It follows [PR and commit messages guidelines](#Pull-Requests-titles-and-message)
- [ ] The pull request does not contain magic strings or numbers that could be replaced with an `Enum` or `const` instead.

#### Bug specific checks

- [ ] The pull request contains `Closes: #Issue` or `Fixes: #Issue` in pull request description.

### Frontend specific checks

- [ ] The pull request does not increase the Angular code base.
  > We are in the process of migrating to React so any increment of Angular code is generally discouraged.
- [ ] The pull request does not contain uses of `any` or `{}` without comments describing why.
- [ ] The pull request does not contain large React components that could easily be split into several smaller components.
- [ ] The pull request does not contain back end calls directly from components, use actions and Redux instead.

#### Redux specific checks (skip if pull request does not contain Redux changes)

- [ ] The pull request does not contain code that mutates state in reducers or thunks.
- [ ] The pull request uses helpers `actionCreatorFactory` and `reducerFactory` instead of traditional `switch statement` reducers in Redux. See [Redux framework](https://github.com/grafana/grafana/tree/master/style_guides/redux.md) for more details.
- [ ] The pull request uses `reducerTester` to test reducers. See [Redux framework](https://github.com/grafana/grafana/tree/master/style_guides/redux.md) for more details.
- [ ] The pull request does not contain code that accesses the reducers state slice directly, instead, the code uses state selectors to access state.
66

67
### Pull Requests titles and message
68

69
70
Pull request titles should follow this format: `Area: Name of the change`.
Titles are used to generate the changelog so they should be as descriptive as possible in one line.
71

72
Good Examples
73

74
75
76
- `Explore: Adds Live option for supported datasources`
- `GraphPanel: Don't sort series when legend table & sort column is not visible`
- `Build: Support publishing MSI to grafana.com`
77

78
The message in the Pull requests should contain a reference so the issue if there is one. Ex `Closes #<issue number>`, `Fixes #<issue number>`, or `Ref #<issue number>` if the change is related to an issue but does not close it. Make sure to explain what problem the pull request is solving and why its implemented this way. As a new contributor its often better to overcommunicate to avoid back and forth communication, as it consumes time and energy.
79

80
### GIT commit formating.
81

82
83
Grafana Squash Pull requests when merging them into master. This means the maintainer will be responsible for the title in the git commit message.
The commit message of the commits in the Pull Request can still be part of the git commit body. So it's always encouraged to write informative commit messages.
84

85
The Git commit title should be short, descriptive and include the Pull Request ID.
86

87
Good Examples
88

89
90
91
- `Explore: Live supprt in datasources (#12345)`
- `GraphPanel: Fix legend sorting issues (#12345)`
- `Build: Support publishing MSI to grafana.com (#12345)`
92

93
Its also good practice to include a reference to the issue in the git commit body when possible.