Code Review
Melanie Frazier & Julie Lowndes
rOpenSci Community Call
October 16, 2018
OUR SITUATION
Global Ocean Health Index calculated every year (since 2012)!
Work in R
Mostly write code to wrangle and analyze data
OUR SITUATION
We review our code every year (4-6 people)
We’ve had a chance to determine what works
IDEAL vs. REALITY
THE BEST: Have someone independently
recreate code
2nd BEST: External review of all code
BUT: Time is an obstacle!
What to do!?
2. PROMOTE COMMON PRACTICES
(tidyverse, etc)
We prioritize documentation over code optimization
(we are sometimes guilty of unnecessary loops, cut-and-paste, etc ….. oh-well!)
3. ERROR AVOIDANCE TRAINING
(no run-on dplyr chains)
(e.g., “# should be length 0”)
4. REVIEW AS A PROCESS
We post results (in near real time as well as for final review) to a Github issue:
5. STRATEGIC CODE REVIEW
git2R to pull data from previous commits
LAST THINGS
Work to create an environment where mistakes are expected and OK (Parker 2017) !
Start of additional resource:
https://rawgit.com/OHI-Science/ohiprep_v2018/master/Reference/CodeReview/code_review.html