How to contribute
Getting the source code
First of all, you need the Avro source code.
The easiest way is to clone or fork the GitHub mirror:
git clone https://github.com/apache/avro.git -o github
Before you start, file an issue in JIRA or discuss your ideas on the Avro developer mailing list. Describe your proposed changes and check that they fit in with what others are doing and have planned for the project. Be patient, it may take folks a while to understand your requirements.
Modify the source code and add some (very) nice features using your favorite IDE.
But take care about the following points
- Contributions should pass existing unit tests.
- Contributions should document public facing APIs.
- Contributions should add new tests to demonstrate bug fixes or test new features.
- All public classes and methods should have informative Javadoc comments.
- Do not use @author tags.
- Java code should be formatted according to Oracle’s conventions, with one exception:
- Indent two spaces per level, not four.
- JUnit is our test framework:
- You must implement a class whose class name starts with Test.
- Define methods within your class and tag them with the @Test annotation. Call JUnit’s many assert methods to verify conditions; these methods will be executed when you run mvn test.
- By default, do not let tests write any temporary files to /tmp. Instead, the tests should write to the location specified by the test.dir system property.
- Place your class in the src/test/java/ tree.
- You can run all the unit tests with the command mvn test, or you can run a specific unit test with the command mvn -Dtest=<class name, fully qualified or short name> test (for example mvn -Dtest=TestFoo test)
Code Style (Autoformatting)
For Java code we use Spotless to format the code to comply with Avro’s code style conventions (see above). Automatic formatting relies on Avro’s Eclipse JDT formatter definition. You can use the same definition to auto format from Eclipse or from IntelliJ configuring the Eclipse formatter plugin.
If you use maven code styles issues are checked at the compile phase. If your code breaks because of bad formatting, you can format it automatically by running the command:
Please make sure that all unit tests succeed before constructing your patch and that no new compiler warnings are introduced by your patch. Each language has its own directory and test process.
cd avro-trunk/lang/java mvn clean test
cd avro-trunk/lang/py ./setup.py build test
cd avro-trunk/lang/rust ./build.sh clean test
cd avro-trunk/lang/csharp ./build.sh clean test
cd avro-trunk/lang/c ./build.sh clean ./build.sh test
cd avro-trunk/lang/c++ ./build.sh clean test
cd avro-trunk/lang/ruby gem install echoe rake clean test
cd avro-trunk/lang/php ./build.sh clean ./build.sh test
Contributing your code
Contribution can be made directly via github with a Pull Request, or via a patch.
Method is to create a pull request.
On your fork, create a branch named with JIRA (avro-1234_fixNpe for example) On source, go to it
git pull git switch avro-1234_fixNpe
code your changes (following preceding recommendations)
check and add updated sources
git status # Add any new or changed files with: git add src/.../MyNewClass.java git add src/.../TestMyNewClass.java
Finally, create a commit with your changes and a good log message, and push it:
git commit -m "AVRO-1234: Fix NPE by adding check to ..." git push
On your github fork site, a button will propose you to build the Pull Request. Click on it, fill Conversation form, and create it. Link this PR to the corresponding JIRA ticket (on JIRA ticket, add PR to “Issue Links” chapter, and add label ‘pull-request-available’ to it .
Please comment on issues in Jira, making your concerns known. Please also vote for issues that are a high priority for you.
Please refrain from editing descriptions and comments if possible, as edits spam the mailing list and clutter Jira’s “All” display, which is otherwise very useful. Instead, preview descriptions and comments using the preview button (on the right) before posting them. Keep descriptions brief and save more elaborate proposals for comments, since descriptions are included in Jira’s automatically sent messages. If you change your mind, note this in a new comment, rather than editing an older comment. The issue should preserve this history of the discussion.
Contributors should join the Avro mailing lists. In particular, the commit list (to see changes as they are made), the dev list (to join discussions of changes) and the user list (to help others).