• Evan W. Patton's avatar
    Implement checkstyle rules for App Inventor (#2149) · 11512a65
    Evan W. Patton authored
    * Implement checkstyle rules for App Inventor
    
    This commit implements checkstyle for App Inventor's Java code. The
    App Inventor style rules are based on the Google style rules, with an
    exception added for methods in the components/runtime package that are
    annotated with `@Simple*` or `@Design*` annotations. The App Inventor
    specific rules are placed at the end of the appinventor_checks.xml
    file.
    
    In addition, there is a script called checkstyle_git.py that is
    written in Python 3 and will check the git diff against the rules by
    running checkstyle on the changed files and crossreferencing the line
    numbers with the checkstyle output. This can be used as a git
    pre-commit hook to check that changes conform to the style guide. The
    script returns -1 on error, which will abort the commit until the
    changes confirm. This behavior can be bypassed by exporting the
    BYPASS_CHECKSTYLE environment variable.
    
    These two changes are made available as ant targets:
    
    - `ant checkstyle`: Run the checkstyle_git.py script to check the
      git diff for problems.
    - `ant checkstyle-all`: Run checkstyle on the whole repo (slow).
    
    Change-Id: I26c6049bd49d1ce3f9b8dbd48f8f115a89fb5b52
    
    * Revamp checkstyle-git script logic
    
    Change-Id: Ie417057b2d009ba70279e70df102851b2f4552cd
    
    * Add custom checks for EventDispatcher in @SimpleEvent
    
    Change-Id: I72a704e9f8d489aa08cefd50ca180b1130b3e5fa
    11512a65
checkstyle-git.py 4.07 KB