Formatting of Java files for Android

The Java files which we have (either automatically generated or modified for more features – those which need android specific APIs) don’t have proper formatting at the moment. There’s some confusion between spaces vs tabs which leads to confusing editors as to what to use. This may result in silly errors in PRs and is a headache in general.

Solutions possible:

  1. Incorporate a automatic file formatter and hook it pre-commit.
  2. Use the in-built auto formatting feature which Android Studio has might be good enough if style is enforced using that method. It will provide consistent styling support across development machines.

These files are rarely changed so let’s not over-engineer it. I might convert all spacing to tabs at some point but in the meantime it seems easy enough to modify only what you need to modify.

1 Like