Consistent code style makes programming easier. This is how we like to have the code in our repo.
- File encoding: UTF-8
- Line endings: Linux (LF, \n)
- Indentation: tabs for java files, spaces for xml files
- Use these as a base guideline
TL;DR Don't worry. Gradle task
checkstyleDebug and Android Studio config file (see below) should guide you to consistent style with the rest of the project. For quick reference, use the same style as the code around your changes.
Mercurial's branching model
We use an adaptation of Vincent Driessen’s Git branching model. First, avoid creating new named branches. Three existing branches are
default- This should be ready to be released at any time without additional work. Accepts only hotfixes and merges from
betawhen making a release.
beta- This is a place to test and stabilize beta versions to be released on Google Play.
develop- Main development branch. May contain multiple heads* but incomplete features or bugfixes should be marked with bookmarks prefixed with
bugfix/followed by issue number and short description. Remember to include issue number (if applicable) also in commit messages.
*) Usually just one head in
develop of bitbeaker-dev-team/bitbeaker, other heads are in forks of this repo. Useful resource: Mercurial: Taming Multiple Heads with Bookmarks.
Config file for Android Studio
Copy config/codestyles/Bitbeaker.xml into your Android Studio
config folder (in your home directory, something like ~/.AndroidStudio/) and restart Android Studio.
Code Style -> select
Bitbeaker as Scheme name.
After you have done it you can use
Code -> Reformat Code... in Android Studio for java and xml files.
Use comments of issue
#137 (Coding guidelines) for discussion of the code style.
Useful tasks for maintaining code quality:
- ./gradlew checkstyle
- ./gradlew findbugs
- ./gradlew lintDevDebug
- ./gradlew pmd
- ./gradlew clean compileDevDebug -Pxlint
- ./gradlew :app:testDevDebug
- ./gradlew connectedAndroidTest