Mobile/Fennec/Android/Static analysis/checkstyle-idea

From MozillaWiki
Jump to navigation Jump to search

You can run checkstyle via the checkstyle-idea plugin within Android Studio or Intellij. It will highlight violations in red, e.g. package statements should not span more than one line:

Example of checkstyle-idea failure

Installation

  1. Open the preferences
  2. Find "Plugins" in the preferences
  3. Click "Browse repositories"
  4. Search for "checkstyle".
  5. Select CheckStyle-IDEA
  6. Click "Install plugin" on the right & confirm
  7. Click restart Android Studio

Adding the config file

  1. Click the "+" in the Configuration File box
  2. Open the preferences
  3. Go to (or search for) "Checkstyle" menu item (it's under "Other Settings")

TODO: can we do this by code? http://mxr.mozilla.org/mozilla-central/source/mobile/android/app/checkstyle.xml