Hello, we are glad to have a contributor like you here.
Don't forget that open-source
makes no sense without contributors. No matter how big your changes are, it helps us a lot even it is a line of change.
This file is intended to be a guide for those who are interested in contributing to the FL Chart.
Make sure you have Flutter installed and on your path (follow the installation guide).
Follow these steps to clone FL Chart and set up the development environment:
-
Fork the repository
-
Clone the project, you can find it in your repositories:
git clone https://github.com/your-username/fl_chart.git
-
Go into the cloned directory:
cd fl_chart
-
Install all packages:
flutter packages get
-
Try to run the sample app. It should work on all platforms (Android, iOS, Web, Linux, MacOS, Windows)
If the work you intend to do is non-trivial, it is necessary to open an issue before starting to write your code. This helps us and the community to discuss the issue and choose what is deemed to be the best solution.
If you are going to fix or improve something, please find and mention the related issues in commit message and Pull Request description. In case you couldn't find any issue, it's better to create an issue to explain what's the issue that you are going to fix.
We have a *_chart_painter.dart class per each chart type. It draws elements into the Canvas. We made the CanvasWrapper class, because we wanted to test draw functions. CanvasWrapper class holds a canvas and all draw functions proxies through it. You should use it for drawing on the canvas, Instead of directly accessing the canvas. It makes draw functions testable.
(made with draw.io)
While you are developing your branch, It is common that your branch gets outdated and you need to update your branch with the master
branch.
To do that, please use rebase
instead of merge
. Because when you finish the PR, we must rebase
your branch and merge it with the master.
The reason that we prefer rebase
over merge
is the simplicity of the commit history. It allows us to have sequential commits in the master
This article might help you understand it better.
After you have made your changes, you have to make sure your code works correctly and meets our guidelines. Our guidelines are:
You can simply run make checkstyle
, and if you faced any formatting problem, run make format
.
- It runs
flutter analyze
to verify that there are no warnings or errors. - It runs
dart format --set-exit-if-changed --dry-run .
to verify that code has formatted correctly.
- It runs
dart format .
to format your code.
- It runs
flutter test
under the hood.
- It runs both
make runTests
and thenmake checkstyle
sequentially with a single command.
We should write unit tests for our written code. If you are not familiar with unit-tests, please start from here.
Mockito is the library that we use to mock our classes. Please read more about it in their docs here.
Our code coverage is calculated by Codecov (Our coverage is at the moment)
When you push something in your PR (after approving your PR by one of us), you see a coverage report which describes how much coverage is increased or decreased by your code (You can check the details to see which part of your code made the change).
Please make sure that your code is not decreasing the coverage.
Congratulations! Your code meets all of our guidelines 💯. Now you have to submit a pull request (PR for short) to us. These are the steps you should follow when creating a PR:
-
Make a descriptive title that summarizes what changes were in the PR.
-
Mention the issues that you are fixing (if they don't exist, try to make one and explain the issue clearly)
-
Change your code according to feedback (if any).
After you follow the above steps, your PR will hopefully be merged. Thanks for contributing!