Contributing to a project involves a series of steps to ensure the changes are consistent with the existing codebase and the project's overall goals. Here's a detailed walkthrough of the process:
2. Create a Branch#
Always work on a new branch for every new feature or bug fix. This keeps your working directory clean and allows you to work on multiple features simultaneously.
git checkout -b feature/my-new-feature
Tip: Use descriptive branch names. It helps in understanding the branch's purpose at a glance.
1. Test Your Code#
Relevant tests should accompany every contribution. This ensures that your changes work as expected and don't introduce bugs.
Example: If you've added a new widget, create tests to verify its behavior under various conditions.
2. Implement Changes#
- Write clean, well-commented code and adhere to the project's coding standards.
- If you're unsure about a particular approach, discuss it in the issue comments or the project's community channels.
3. Code Formatting#
Maintain a consistent coding style across the project using Dart's formatting tool.
dart format -w .
4. Analyze Your Code#
Ensure that your code adheres to Dart's best practices and has no potential issues.
dart analyze --fatal-infos --fatal-warnings .
1. Commit Properly#
Group-related changes into individual commits.
Use clear and concise commit messages describing the changes.
Example: Instead of "fix bugs", use "fix null pointer exception in WidgetRenderer".
- Enhance the documentation if you've introduced new features, made changes to the public API, or feel that a particular aspect of the project needs clearer instructions.
Before submitting your changes, ensure all existing tests pass. Run:
1. PR Creation#
Push your branch to your fork and create a pull request (PR) against the main Widgetbook repository.
Tip: In the PR description, provide a detailed overview of the changes and their motivations, and if they're related to any existing issues, link those.
2. PR Conventions#
- Adhere to the project's PR title and description conventions. If the project follows a specific format or template, ensure your PR respects that.