This is a living document. If you see something that could be improved, edit this document and submit a pull request following the instructions below!
To contribute code to ODK Counter, you will need to open a pull request which will be reviewed by the community and then merged into the core project.
-
To make sure you have the latest version of the code, set up this repository as a remote for your fork and then sync your fork.
-
Create a branch for the code you will be writing:
git checkout -b NAME_OF_YOUR_BRANCH
-
If there is an issue corresponding to what you will work on, comment on it to say you are addressing it. If there is no issue yet, create one to provide background on the problem you are solving.
-
Once you've made incremental progress towards you goal, commit your changes with a meaningful commit message. Use keywords for closing issues to refer to issues and have them automatically close when your changes are merged.
git commit -m "Do a thing. Fix #1."
-
Push changes to your fork at any time to make them publicly available:
git push
-
Once you have completed your code changes, verify that you have followed the style guidelines. Additionally, ktlint is run for each new build so please run
gradle lint
and fix any errors before issuing a pull request. -
When your changes are ready to be added to the core ODK Counter project, open a pull request. Make sure to set the base fork to
opendatakit/counter
. Describe your changes in the comment, refer to any relevant issues using keywords for closing issues and tag any person you think might need to know about the changes. -
Pull requests will be reviewed when committers have time. If you haven't received a review in 10 days, you may notify committers by putting
@opendatakit/counter
in a comment.
-
Confirm that your code compiles.
-
Verify the functionality. Ideally, include automated tests with each pull request. If that's not possible, describe in the pull request comment which cases you tried manually to confirm that your code works as expected. Attach a test form when appropriate. This form should only include questions which are useful for verifying your change.
-
Make sure that there is an issue that corresponds to the pull request and that it has been discussed by the community as necessary.
-
Keep your pull request focused on one narrow goal. This could mean addressing an issue with multiple, smaller pull requests. Small pull requests are easier to review and less likely to introduce bugs. If you would like to make stylistic changes to the code, create a separate pull request.
-
Run
./gradlew ktlintCheck
and./gradlew checkstyle
and fix any errors. -
Write clear code. Use descriptive names and create meaningful abstractions (methods, classes).
-
Document your reasoning. Your commit messages should make it clear why each change has been made.
-
Follow the guidelines below.
Bug fixes, pull requests corresponding to issues with a clearly stated goal and pull requests with clear tests and/or process for manual verification are given priority. Pull requests that are unclear or controversial may be tagged as needs discussion
and/or may take longer to review.
We try to have at least two people review every pull request and we encourage everyone to participate in the review process to get familiar with the code base and help ensure higher quality. Reviewers should ask themselves some or all of the following questions:
- Was this change adequately discussed prior to implementation?
- Is the intended behavior clear under all conditions?
- What interesting cases should be verified?
- Is the behavior as intended in all cases?
- What other functionality could this PR affect? Does that functionality still work as intended?
- Was the change verified with several different devices and Android versions?
- Is the code easy to understand and to maintain?
Pull requests that need more black-box testing are tagged with needs testing
. Pull requests that need more complete reviews including black-box testing but also review of approach and/or appropriateness are tagged with reviews wanted
. Any contributor is encouraged to participate in both kinds of reviews!
Small fixes that target very particular bugs may occasionally be merged without a second review.
Follow the Android style rules and the Google Java style guide.
Always use string resources instead of literal strings. This ensures wording consistency across the project and also enables full translation of the app. Only make changes to the base res/values/strings.xml
English file and not to the other language files. The translated files are generated from Transifex where translations can be submitted by the community. Names of software packages or other untranslatable strings should be placed in res/values/untranslated.xml
.
ODK Counter is released under the Apache 2.0 license. Please make sure that any code you include is an OSI-approved permissive license. Please note that if no license is specified for a piece of code or if it has an incompatible license such as GPL, using it puts the project at legal risk.
Sites with compatible licenses (including StackOverflow) will sometimes provide exactly the code snippet needed to solve a problem. You are encouraged to use such snippets in ODK Counter as long as you attribute them by including a direct link to the source. In addition to complying with the content license, this provides useful context for anyone reading the code.