RLint: Reformatting R Code to Follow the Google Style GuideAlex Blocker, Andy Chen ([email protected]), Andy Chu, Tim Hesterberg, Jeffrey D. Oldham, C
Google Confidential and ProprietaryEx: IndentationCodeif (x == 5)while (x > 1) # R-bleed bug? ;) x <- x - 1 print(x)Corrected codeif (x =
Google Confidential and ProprietaryEx: Ease checking program correctnessCodex <- -5:-1x[x <-2]Is anything wrong?
Google Confidential and ProprietaryEx: Ease checking program correctnessCodex <- -5:-1x[x <-2] # Hmm ...WarningMust have whitespace around &
Google Confidential and ProprietaryEx: Ease checking program correctnessCodeif (format(Sys.time(), "%Y") == "2014") { print(paste
Google Confidential and ProprietaryEx: Ease checking program correctnessCodeif (format(Sys.time(), "%Y") == "2014") { print(paste
Google Confidential and ProprietaryRLint implementation uses PythonUse Python string functions and regular expressions.Algorithm:Stub out comments, st
Google Confidential and ProprietaryApplication: Improve R community's style consistencyProposal: Adopt R style guide + RLint.● Run experiments to
Google Confidential and ProprietarySummaryRLint checks and reformats R code to follow R style guide.RLint used within Google● Eases checking correctne
RLint: Reformatting R Code to Follow the Google Style GuideAlex Blocker, Andy Chen ([email protected]), Andy Chu, Tim Hesterberg, Jeffrey D. Oldham, C
Google Confidential and ProprietaryCoding conventions and checkersCoding conventions have existed for decades.● 1918: The Elements of Style by Strunk
Google Confidential and ProprietarySummaryRLint checks and reformats R code to follow R style guide.RLint used within Google.● Eases checking correctn
Google Confidential and ProprietaryStyle guides improve correctness and productivityQ: How do we produce correct R code when● correctness is hard to c
Google Confidential and ProprietaryMany R files modified by multiple users~50% directories contain code written by >1 Googler.~40% files modified b
Google Confidential and ProprietaryStyle guides improve correctness and productivityQ: How do we produce correct R code when● correctness is hard to c
Google Confidential and ProprietaryStyle guides specify program structureGoogle R style guide specifies● identifier naming: variable.name, FunctionNam
Google Confidential and ProprietaryRLint: Automate style checking and correctionGoal: Minimize overhead of following style guide.RLint: Program warnin
Google Confidential and ProprietaryEx: SpacingCode: foo <-function(x){ return (list ( a = sum(x[,1]), b = 1/3+1e-7*(x[1,1])) …Warni
Google Confidential and ProprietaryEx: IndentationCodeif (x == 5)while (x > 1) x <- x - 1 print(x)Is anything wrong?
Komentáře k této Příručce