contribute/create-pull-request.md
Every contribution to Grafana's software begins with a pull request. This document guides you through the process of creating a PR.
We know you're excited to create your first pull request. Before we get started, read these resources first:
If this is your first time contributing to an open-source project on GitHub, make sure you read GitHub's article on creating a pull request.
To increase the chance of having your pull request accepted, make sure your pull request follows these guidelines:
If the pull request fixes a bug:
Closes #<issue number> or Fixes #<issue number>.Pull requests for frontend contributions must:
any or {} without reason.Pull requests for Redux contributions must:
actionCreatorFactory and reducerFactory helpers instead of traditional switch statement reducers in Redux. Refer to Redux framework for more details.reducerTester to test reducers. Refer to Redux framework for more details.Pull requests that add or modify unit tests that are written in Jest must adhere to these guidelines:
Pull requests that create new UI components or modify existing ones must adhere to the following accessibility guidelines:
Before submitting pull requests that introduce accessibility (a11y) errors, refer to the accessibility guidelines.
We use ESLint to enforce code style and best practices, along with bulk suppressions in order to incrementally improve our code quality and fix rule violations.
eslint-suppressions.json file automatically added to your commits.git commit --no-verify. All errors will eventually have to be fixed before your code can be merged because...There are suppressions left that do not occur anymore..
To resolve the error, run the following command: yarn lint:prune and commit the changes.eslint-suppressions.json file. To resolve, merge with the target branch (usually main) and resolve conflicts however you like, and then run yarn lint:prune to ensure the file is up to date and commit.Refer to the backend style guidelines.
Once you've created a pull request, the next step is to have someone review your change. A review is a learning opportunity for both the reviewer and the author of the pull request.
If you think a specific person needs to review your pull request, then you can tag them in the description or in a comment. To tag a user on GitHub, go to Reviewers box on the Conversations page and enter the @ symbol followed by their GitHub username.
We recommend that you read How to do a code review to learn more about code reviews.
A well-written pull request minimizes the time to get your change accepted. The following guidelines help you to write good commit messages and descriptions for your pull requests.
Grafana uses the guidelines for commit messages outlined in the article How to Write a Git Commit Message, with the following additions:
The area refers to a specific part of Grafana's codebase. It should be given in the upper camel case format. For example: UpperCamelCase.
Prefer using one of the following areas:
For changes to data sources, the area is the name of the data source. For example, AzureMonitor, Graphite, or Prometheus.
For changes to panels, the area is the name of the panel, suffixed with Panel. For example, GraphPanel, SinglestatPanel, or TablePanel.
Examples of good commit messages
Build: Support publishing MSI to grafana.comExplore: Add Live option for supported data sourcesGraphPanel: Fix legend sorting issuesDocs: Change url to URL in all documentation filesIf you're unsure, see the existing changelog for inspiration or guidance.
The pull request title should be formatted according to <Area>: <Summary> (Both "Area" and "Summary" should start with a capital letter).
The Grafana team squashes all commits into one when we accept a pull request. The title of the pull request becomes the subject line of the squashed commit message. We still encourage contributors to write informative commit messages, as they become a part of the Git commit body.
We use the pull request title when we generate change logs for releases. As such, we strive to make the title as informative as possible.
Example:
Docs: Change url to URL in all documentation files
If your pull request includes configuration changes, all the following files must be changed correspondingly:
conf/defaults.iniconf/sample.inidocs/sources/administration/configuration.md