rcv
rcv copied to clipboard
Document coding setup / workflows for future contributors and our reference
We should document our IntelliJ setup, which plugins we use, how to use Gradle in IntelliJ and via the CLI, which checkboxes should be used when committing, etc.
This popped up in #386 and #387 since it became apparent that we need instructions for enabling the Checkstyle-IDEA plugin in IntelliJ, and how to run checkstyle using Gradle, and the fact that the HTML reports are generated locally in rcv\build\reports\checkstyle.
This could be done by creating a CONTRIBUTING.md file, as mentioned in these GitHub docs. Or maybe another method is better (e.g. keeping an issue open / for reference, like how we've been using #289).
From initial email from @tarheel, re: Checkstyle IntelliJ plugin:
OK, so I used Checkstyle to assess our code's compliance with Google's Java style conventions.
How to use it: you install the Checkstyle plugin in IntelliJ (by going to Preferences/Settings, then Plugins, and searching for "checkstyle"), then open the Checkstyle tab, select "Google Checks" from the Rules pulldown, and click the Check Project button. It returns a list of warnings corresponding to lines of code that it believes are failing to comply with the standard.
After enabling Gradle Checkstyle plugin, reports can be generated with:
$ gradlew checkstyleMain
$ gradlew checkstyleTest
Both the IntelliJ and Gradle plugins are useful for development work on this project.
Other useful info from old emails I scraped today as I was reinstalling stuff:
Hey y'all, an update on this. I was just getting my coding environment set up on my desktop and I found this IntelliJ plugin for Google reformat. Note that this is a different from the Google style guide XML file as is outlined in the docs, as it overrides the "Reformat Code" option in IntelliJ to actually put everything in Google format. My sense is that the style guide XML is for stuff like spacing, etc., whereas the plugin goes deeper and actually enforces the rules for defining functions, breaking up expressions, etc. ...
- Download the zip from the first link.
- In IntelliJ go to Settings > Plugins > Install plugin from disk... and select the zip.
- Once that's done (restart IntelliJ), go to Settings > google-java-format Settings > Enable google-java-format
- Select "Default Google Java style"
Note that we'd be using this plugin in addition to the XML, which is activated as follows (I think we all already did this):
- Download intellij-java-google-style.xml from the second link above.
- In IntelliJ go to Settings > Editor > Code Style
- Next to Scheme click the gear and say Import Scheme > IntelliJ IDEA...
- Load the xml and make sure scheme is "GoogleStyle".
And:
Each time we commit (ctrl-k in IntelliJ), we check all the options on the side:
- Reformat code
- Rearrange code
- Optimize imports
- Perform code analysis
- Check TODO
- Cleanup
- Update copyright
This should be done in the Wiki we just set up.