Skip to content

Commit

Permalink
Merge pull request #167 from JanMarvin/lintr
Browse files Browse the repository at this point in the history
Add lintr config
  • Loading branch information
ycphs authored Apr 3, 2021
2 parents 69c5db6 + 9f0da25 commit b253027
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 24 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ cran-comments.md
^.*\.github\*
.travis.yml
.appveyor.yml
.lintr
^cran-comments\.md$
^CRAN-RELEASE$
^_pkgdown\.yml$
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master

name: lint
Expand All @@ -16,7 +18,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-r@v1

- name: Query dependencies
run: |
Expand All @@ -25,8 +27,8 @@ jobs:
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
uses: actions/cache@v1
- name: Restore R package cache
uses: actions/cache@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
Expand All @@ -39,6 +41,9 @@ jobs:
remotes::install_cran("lintr")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
18 changes: 18 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
linters: with_defaults(
line_length_linter = NULL, # we have many long lines
cyclocomp_linter = NULL, #
commented_code_linter = NULL, #
snake_case_linter = NULL, # we prefered camel case
trailing_whitespace_linter = NULL, # have a few cases
commas_linter = NULL, #
paren_brace_linter = NULL, #
object_name_linter = NULL, # more camel case
infix_spaces_linter = NULL, #
function_left_parentheses_linter = NULL, #
spaces_inside_linter = NULL, #
spaces_left_parentheses_linter = NULL, #
no_tab_linter = NULL, #
single_quotes_linter = NULL, #
object_length_linter = NULL, #
assignment_linter = NULL # just one case
)
2 changes: 1 addition & 1 deletion inst/extdata/build_font_size_lookup.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ cat(allStrs)



# nolint end
# nolint end
4 changes: 3 additions & 1 deletion inst/extdata/conditional_formatting_testing.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# nolint start


wb <- createWorkbook()
Expand Down Expand Up @@ -76,3 +76,5 @@ wb <- loadWorkbook(fl)
conditionalFormatting(wb, "Duplicates", cols = 1, rows = 1:10, type = "duplicates", style = createStyle(textDecoration = 'BOLD'))
openXL(wb)


# nolint end
4 changes: 2 additions & 2 deletions inst/extdata/load_xlsx_testing.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# nolint start
require('openxlsx')

unzip_xlsx <- function(fl){
Expand Down Expand Up @@ -172,4 +172,4 @@ openXL(file.path(test_file_dir, "pivotTest.xlsx"))




# nolint end
19 changes: 2 additions & 17 deletions inst/extdata/stack_style_testing.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# nolint start


require('openxlsx')
Expand Down Expand Up @@ -123,19 +123,4 @@ addStyle(wb, 3, createStyle(textDecoration = "bold", fgFill = "salmon"), 2:4, 2:

openXL(wb)

















# nolint end

0 comments on commit b253027

Please sign in to comment.