|
| 1 | +# Contributing to dart-casbin |
| 2 | + |
| 3 | +Thank you for your interest in contributing to dart-casbin! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +By participating in this project, you agree to maintain a respectful and collaborative environment. |
| 8 | + |
| 9 | +## How to Contribute |
| 10 | + |
| 11 | +### Reporting Bugs |
| 12 | + |
| 13 | +If you find a bug, please create an issue on GitHub with: |
| 14 | +- A clear, descriptive title |
| 15 | +- Steps to reproduce the issue |
| 16 | +- Expected behavior vs actual behavior |
| 17 | +- Your environment (Dart version, OS, etc.) |
| 18 | +- Any relevant code samples or error messages |
| 19 | + |
| 20 | +### Suggesting Enhancements |
| 21 | + |
| 22 | +Enhancement suggestions are welcome! Please create an issue with: |
| 23 | +- A clear description of the enhancement |
| 24 | +- Use cases and benefits |
| 25 | +- Any implementation ideas you may have |
| 26 | + |
| 27 | +### Pull Requests |
| 28 | + |
| 29 | +1. **Fork the repository** and create your branch from `master` |
| 30 | + ```bash |
| 31 | + git checkout -b feature/your-feature-name |
| 32 | + ``` |
| 33 | + |
| 34 | +2. **Make your changes** |
| 35 | + - Write clear, self-documenting code |
| 36 | + - Follow the existing code style |
| 37 | + - Add tests for new functionality |
| 38 | + - Update documentation as needed |
| 39 | + |
| 40 | +3. **Test your changes** |
| 41 | + ```bash |
| 42 | + dart pub get |
| 43 | + dart format . |
| 44 | + dart test |
| 45 | + ``` |
| 46 | + |
| 47 | +4. **Commit your changes** |
| 48 | + - Use clear, descriptive commit messages |
| 49 | + - Follow [Conventional Commits](https://www.conventionalcommits.org/) format: |
| 50 | + - `feat:` for new features |
| 51 | + - `fix:` for bug fixes |
| 52 | + - `docs:` for documentation changes |
| 53 | + - `refactor:` for code refactoring |
| 54 | + - `test:` for test changes |
| 55 | + - `chore:` for maintenance tasks |
| 56 | + |
| 57 | +5. **Push to your fork** and submit a pull request |
| 58 | + ```bash |
| 59 | + git push origin feature/your-feature-name |
| 60 | + ``` |
| 61 | + |
| 62 | +6. **Wait for review** - A maintainer will review your PR and may request changes |
| 63 | + |
| 64 | +## Development Setup |
| 65 | + |
| 66 | +1. **Install Dart SDK**: Follow the [official Dart installation guide](https://dart.dev/get-dart) |
| 67 | + |
| 68 | +2. **Clone the repository** |
| 69 | + ```bash |
| 70 | + git clone https://github.com/casbin/dart-casbin.git |
| 71 | + cd dart-casbin |
| 72 | + ``` |
| 73 | + |
| 74 | +3. **Install dependencies** |
| 75 | + ```bash |
| 76 | + dart pub get |
| 77 | + ``` |
| 78 | + |
| 79 | +4. **Run tests** |
| 80 | + ```bash |
| 81 | + dart test |
| 82 | + ``` |
| 83 | + |
| 84 | +5. **Check formatting** |
| 85 | + ```bash |
| 86 | + dart format --output=none --set-exit-if-changed . |
| 87 | + ``` |
| 88 | + |
| 89 | +## Code Style |
| 90 | + |
| 91 | +- Follow the [Effective Dart](https://dart.dev/guides/language/effective-dart) style guide |
| 92 | +- Use `dart format` to format your code |
| 93 | +- Use relative imports for internal packages |
| 94 | +- Add appropriate comments for complex logic |
| 95 | +- Maintain consistency with existing code |
| 96 | + |
| 97 | +## Testing |
| 98 | + |
| 99 | +- Write tests for all new functionality |
| 100 | +- Ensure all tests pass before submitting a PR |
| 101 | +- Aim for high test coverage |
| 102 | +- Tests should be clear and maintainable |
| 103 | + |
| 104 | +## Documentation |
| 105 | + |
| 106 | +- Update the README.md if you change functionality |
| 107 | +- Add dartdoc comments for public APIs |
| 108 | +- Include code examples in documentation where helpful |
| 109 | +- Keep the CHANGELOG.md updated (this is done automatically via semantic-release) |
| 110 | + |
| 111 | +## Questions? |
| 112 | + |
| 113 | +If you have questions, feel free to: |
| 114 | +- Open an issue on GitHub |
| 115 | +- Join our [Discord community](https://discord.gg/S5UjpzGZjN) |
| 116 | +- Contact the maintainers at hsluoyz@gmail.com |
| 117 | + |
| 118 | +## License |
| 119 | + |
| 120 | +By contributing, you agree that your contributions will be licensed under the Apache 2.0 License. |
0 commit comments