|
| 1 | +# Contribution Guidelines |
| 2 | + |
| 3 | +Welcome every user and developer in the community to become contributors. Whether it's reporting issues, improving documentation, submitting code, or providing technical support, your participation will help make FastExcel better. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Contribution Directions |
| 8 | + |
| 9 | +There are many ways to contribute to FastExcel: |
| 10 | + |
| 11 | +- Fix typos |
| 12 | +- Fix bugs |
| 13 | +- Remove redundant code |
| 14 | +- Add test cases |
| 15 | +- Enhance functionality |
| 16 | +- Add comments to improve code readability |
| 17 | +- Optimize code structure |
| 18 | +- Improve or refine documentation |
| 19 | + |
| 20 | +**Principle**: |
| 21 | +- Any pull request that contributes to the improvement of the project should be encouraged. |
| 22 | +- Before contributing a new feature, please propose and discuss it in an `issue` or `discussion`. We will not merge features that have not been discussed and confirmed. |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## Contributing Code |
| 27 | + |
| 28 | +All improvements can be implemented through Pull Request (PR). Before submitting a Pull Request, please familiarise yourself with the following guidelines: |
| 29 | + |
| 30 | +### Workspace Preparation |
| 31 | + |
| 32 | +Developing FastExcel requires **Maven 3.8** and **JDK (Java Development Kit)**. Currently, the development environment requires **Java 21** or higher, but during compilation, you must use language features compatible with **Java 1.8** to ensure that FastExcel can run in Java 1.8 or higher environments. |
| 33 | + |
| 34 | +> You can use tools such as [SDKMAN](https://sdkman.io/) to configure multiple versions of the Java toolchain. |
| 35 | +
|
| 36 | +### Fork the repository |
| 37 | + |
| 38 | +Ensure that you have registered a GitHub account and follow the steps below to configure your local development environment: |
| 39 | + |
| 40 | +**Fork the repository**: Click the `Fork` button on the FastExcel [GitHub page](https://github.com/fast-excel/fastexcel) to copy the project to your GitHub account. |
| 41 | + |
| 42 | +``` |
| 43 | +https://github.com/<your-username>/fastexcel |
| 44 | +``` |
| 45 | + |
| 46 | +**Clone Repository**: Run the following command to clone the forked project to your local machine: |
| 47 | +```bash |
| 48 | +git clone [email protected]: <your-username >/fastexcel.git |
| 49 | +``` |
| 50 | + |
| 51 | +**Set Upstream Repository**: Set the official repository as `upstream` for easy synchronization of updates: |
| 52 | +```bash |
| 53 | +git remote add upstream [email protected]:fast-excel/fastexcel.git |
| 54 | +git remote set-url --push upstream no-pushing |
| 55 | +``` |
| 56 | + |
| 57 | +Running `git remote -v` can verify if the configuration is correct. |
| 58 | + |
| 59 | + |
| 60 | +### Branch definition |
| 61 | + |
| 62 | +In FastExcel, all contributions should be based on the `main` development branch. Additionally, there are the following branch types: |
| 63 | + |
| 64 | +- **release branches**: Used for version releases (e.g., `1.1.0`, `1.1.1`). |
| 65 | +- **feature branches**: Used for developing major features. |
| 66 | +- **hotfix branches**: Used for fixing critical bugs. |
| 67 | + |
| 68 | +When submitting a PR, please ensure that the changes are based on the `main` branch. |
| 69 | + |
| 70 | +### Commit Rules |
| 71 | + |
| 72 | +#### Commit Message |
| 73 | + |
| 74 | +Please ensure that commit messages are clear and descriptive, use **English**, and do not exceed 100 characters. |
| 75 | + |
| 76 | +The following types of commit messages are allowed and must follow the following format: |
| 77 | + |
| 78 | +- **docs**: Update documentation, e.g., `docs: update README.md` |
| 79 | +- **feature/feat**: New features, e.g., `feature: support for xxx` |
| 80 | +- **bugfix/fix**: Bug fixes, e.g., `fix: fix NPE in the A class` |
| 81 | +- **refactor**: Code refactoring (no functional changes), e.g., `refactor: optimise data processing logic` |
| 82 | +- **style**: Code formatting, e.g., `style: update code style` |
| 83 | +- **test**: Adding or improving tests, e.g., `test: add new test cases` |
| 84 | +- **chore**: Changes to the build process or auxiliary tools, e.g., `chore: improve issue template` |
| 85 | +- **dependency**: Modifications to third-party dependency libraries, e.g., `dependency: upgrade poi version to 5.4.1` |
| 86 | + |
| 87 | +Avoid using vague commit messages like: |
| 88 | + |
| 89 | +- ~~fixed issue~~ |
| 90 | +- ~~update code~~ |
| 91 | + |
| 92 | +For assistance, refer to [How to Write a Git Commit Message](http://chris.beams.io/posts/git-commit/). |
| 93 | + |
| 94 | +#### Commit Content |
| 95 | + |
| 96 | +Each commit should contain complete and reviewable changes, ensuring: |
| 97 | + |
| 98 | +- Avoid committing overly large changes. |
| 99 | +- Each commit content is independent and can pass CI tests. |
| 100 | + |
| 101 | +Also, ensure the correct Git user information is configured when committing: |
| 102 | + |
| 103 | +```bash |
| 104 | +git config --get user.name |
| 105 | +git config --get user.email |
| 106 | +``` |
| 107 | + |
| 108 | +### PR Description |
| 109 | + |
| 110 | +To help reviewers quickly understand the content and purpose of the PR, use the [PR 模板](https://github.com/fast-excel/fastexcel/blob/main/.github/pull_request_template.md). A detailed description greatly improves code review efficiency. |
| 111 | + |
| 112 | +--- |
| 113 | + |
| 114 | +## Contribution of Test Cases |
| 115 | + |
| 116 | +Any contribution of test cases is encouraged, especially unit tests. It is recommended to create `XXXTest.java` files in the corresponding module's `test` directory, preferably using the `JUnit5` framework. |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## Contribution Document |
| 121 | + |
| 122 | +Documentation is an important component of the FastExcel official website and serves as a vital bridge between the project and the community. |
| 123 | + |
| 124 | +### Directory Structure Description |
| 125 | + |
| 126 | +```bash |
| 127 | +. |
| 128 | +├── quickstart # 1. Quick Start |
| 129 | +├── read # 2. Read |
| 130 | +├── write # 3. Write |
| 131 | +├── fill # 4. Fill |
| 132 | +├── community # 5. Community |
| 133 | +└── help # 6. FAQ |
| 134 | +``` |
| 135 | + |
| 136 | +### Documentation Writing Guidelines |
| 137 | + |
| 138 | +- Use file paths with the `.md` extension |
| 139 | +``` markdown |
| 140 | +[Example](quickstart/example.md) |
| 141 | +``` |
| 142 | + |
| 143 | +- Use paths relative to the docs/ directory |
| 144 | +``` markdown |
| 145 | +[Example](quickstart/example.md) |
| 146 | +``` |
| 147 | + |
| 148 | +- Image files must be stored in the `docs/images` directory and referenced using relative directory paths. |
| 149 | +``` markdown |
| 150 | +[img](../../images/fill/listFill_file.png) |
| 151 | +``` |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## Other Ways to Contribute |
| 156 | + |
| 157 | +Apart from directly contributing code, the following ways are also valuable support for FastExcel: |
| 158 | + |
| 159 | +- Answering other users' questions. |
| 160 | +- Assisting in reviewing others' PRs. |
| 161 | +- Providing improvement suggestions. |
| 162 | +- Writing technical blogs to promote FastExcel. |
| 163 | +- Sharing project-related knowledge in the community. |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## Code Style |
| 168 | + |
| 169 | +FastExcel uses [Spotless](https://github.com/diffplug/spotless) as its code formatting tool. Please ensure you run the following command to automatically format your code before submitting: |
| 170 | + |
| 171 | +```bash |
| 172 | +mvn spotless:apply |
| 173 | +``` |
| 174 | + |
| 175 | +--- |
| 176 | + |
| 177 | +Finally, thank you for your support of FastExcel! |
0 commit comments