Skip to content

Commit

Permalink
ARROW-13562: [R] Styler followups
Browse files Browse the repository at this point in the history
Adds styling tasks to the Makefile (for 🦖  like me; I found that the styling-on-save from vscode was not reliable). Also makes codegen.R generate styled R code.

Closes #10879 from nealrichardson/styler2

Lead-authored-by: Jonathan Keane <[email protected]>
Co-authored-by: Neal Richardson <[email protected]>
Signed-off-by: Jonathan Keane <[email protected]>
  • Loading branch information
jonkeane and nealrichardson committed Aug 4, 2021
1 parent fab0d70 commit cbcf5cb
Show file tree
Hide file tree
Showing 13 changed files with 944 additions and 921 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/comment_bot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
# only grab the .R files under r/
changed_files <- grep('^r/.*\\.R$', changed_files, value = TRUE)
# remove latin1 which is unstylable due to encoding and codegen.R which is unique
changed_files <- changed_files[!changed_files %in% c("r/tests/testthat/latin1.R", "r/data-raw/codegen.R")]
changed_files <- changed_files[!changed_files %in% file.path("r", source("r/.styler_excludes.R")$value)]
source("ci/etc/rprofile")
install.packages(c("remotes", "styler"))
remotes::install_deps("r")
Expand Down
1 change: 1 addition & 0 deletions r/.Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ clang_format.sh
^extra-tests
STYLE.md
^.lintr
^.styler_excludes.R
18 changes: 18 additions & 0 deletions r/.styler_excludes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

c("tests/testthat/latin1.R", "data-raw/codegen.R")
8 changes: 7 additions & 1 deletion r/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ VERSION=$(shell grep ^Version DESCRIPTION | sed s/Version:\ //)
ARROW_R_DEV="TRUE"
ARROW_LARGE_MEMORY_TESTS=$(ARROW_R_DEV)

doc:
style:
R -s -e 'setwd(".."); if (requireNamespace("styler")) styler::style_file(setdiff(system("git diff --name-only | grep r/.*R$$", intern = TRUE), file.path("r", source("r/.styler_excludes.R")$$value)))'

style-all:
R -s -e 'styler::style_file(setdiff(dir(pattern = "R$$", recursive = TRUE), source(".styler_excludes.R")$$value))'

doc: style
R -s -e 'roxygen2::roxygenize()'
-git add --all man/*.Rd

Expand Down
Loading

0 comments on commit cbcf5cb

Please sign in to comment.