The GBIF Pipelines development community welcomes contributions from anyone! Thank you.
If you have questions please open an issue or join the mailing list.
There are different ways you can contribute that help this project:
- Log issues and help document a bug or specify new functionality
- Improve documentation
- Provide code submissions that address issues or bring new functionalities
- Help test the functionalities offered in the project
- Help improve this guide
Below is a tutorial for contributing code to Pipelines, covering our tools and typical process in detail.
To contribute code, you need
- a GitHub account
- a Linux, MacOS, or Microsoft Windows development environment with Java JDK 8 installed
- Maven (version 3.6+)
- This is a very active project, with dependencies coming from those running in production.
- It is always worthwhile announcing your intention, so the community can offer guidance.
- Please always start with an issue to capture discussion
This project uses Apache Maven to build. The following should be enough to checkout and build the project.
git clone [email protected]:gbif/pipelines.git
cd pipelines
build.sh
Using maven commands, the project can be built with mvn clean package
(optionally with -DskipTests
to skip tests) and integration tests run with mvn verify
.
We use Google Java Format for code styling.
From the command line you can check the style using mvn spotless:check
and fixup styling issues using mvn spotless:apply
.
We recommend the following toolset, and are able to answer questions on this configuration:
- Use IntelliJ IDEA Community (or better),
- Use the Google Java Format. Please do not reformat existing code, only changes and new code.
- The project uses Project Lombok. Please install the Lombok plugin for IntelliJ IDEA.
- Because the project uses Error Prone you may have issues during the build process from IDEA. To avoid these issues please install the Error Prone compiler integration plugin and build the project using the
error-prone java compiler
to catch common Java mistakes at compile-time. To use the compiler, go to File → Settings → Compiler → Java Compiler and selectJavac with error-prone
in theUse compiler
box. - Add a custom parameter to avoid a debugging problem. To use the compiler, go to File → Settings → Compiler → Java Compiler → Additional command line parameters and add
-Xep:ParameterName:OFF
- Tests: please follow the conventions of the Maven Surefire plugin for unit tests and those of the Maven Failsafe plugin for integration tests. To run the integration tests just run the verify phase, e.g.:
mvn clean verify
We follow a GitFlow approach to our project. This can be summarized as:
master
represents what is running in production, or is in the process of being released for a new deploymentgbif-dev
represents the latest state of development, and is what is run by the continuous build tools- Generally feature branches are made from here
ala-dev
represents a large feature branch to bring in thelivingatlas
module and pipelines for the ALA work
If you are working on a new feature and not part of the core team please ask for guidance on where to start (most likely gbif-dev
).
- Checkout the branch you need (or fork the project and then checkout the branch)
- Create a feature branch following a naming convention of
<issue_number>_my_new_feature
- Add unit tests for your change (please see testing style below)
- Arrange your commits
- Consider merging commits. We favour fewer commits, but recognize this is not always desirable for large features (please squash small commits addressing typos etc. into one)
- Use descriptive commit messages that make it easy to identify changes and provide a clear history.
- Please reference the issue you are working on unless it is a trivial change
- Examples of good commit messages:
#123 Enable occurrenceStatus interpretation to Avro
Fixup: Addressing typos in JDoc
- Examples of bad commit messages:
Various fixes
#123
- Check your code compiles, and all project unit tests pass (please be kind to reviewers)
- Explore the
errorprone
warnings raised at compilation time. Please address issues you see as best you can. - Ensure that the code is spotless (
mvn spotless:check
and fixup styling issues usingmvn spotless:apply
) - Verify that the PR only changes the code necessary to address the issue (other fixes should be in separate PRs)
- Prefer to create a pull request and have it reviewed for larger submissions. Committers are free to push smaller changes directly.
- Committers are requested to delete branches once merged.
The following illustrates the preferred style for unit tests.
@Test
public void allValuesNullTest() {
// State
String eventDate = null;
String year = null;
String month = null;
String day = null;
// When
ParsedTemporal result = TemporalParser.parse(year, month, day, eventDate);
// Should
assertFalse(result.getFromOpt().isPresent());
assertFalse(result.getToOpt().isPresent());
assertFalse(result.getYearOpt().isPresent());
assertFalse(result.getMonthOpt().isPresent());
assertFalse(result.getDayOpt().isPresent());
assertFalse(result.getStartDayOfYear().isPresent());
assertFalse(result.getEndDayOfYear().isPresent());
assertTrue(result.getIssues().isEmpty());
}