diff --git a/.Rbuildignore b/.Rbuildignore index 93930e7c..e32b748f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -5,6 +5,7 @@ cran-comments.md ^.*\.github\* .travis.yml .appveyor.yml +.lintr ^cran-comments\.md$ ^CRAN-RELEASE$ ^_pkgdown\.yml$ diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 36a22376..cf0385fb 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,9 +1,11 @@ on: push: branches: + - main - master pull_request: branches: + - main - master name: lint @@ -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: | @@ -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') }} @@ -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} diff --git a/.lintr b/.lintr new file mode 100644 index 00000000..3c9ce715 --- /dev/null +++ b/.lintr @@ -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 + ) diff --git a/inst/extdata/build_font_size_lookup.R b/inst/extdata/build_font_size_lookup.R index ffbe1f7d..071f7cac 100644 --- a/inst/extdata/build_font_size_lookup.R +++ b/inst/extdata/build_font_size_lookup.R @@ -61,4 +61,4 @@ cat(allStrs) -# nolint end \ No newline at end of file +# nolint end diff --git a/inst/extdata/conditional_formatting_testing.R b/inst/extdata/conditional_formatting_testing.R index 76ecf450..b95d3510 100644 --- a/inst/extdata/conditional_formatting_testing.R +++ b/inst/extdata/conditional_formatting_testing.R @@ -1,4 +1,4 @@ - +# nolint start wb <- createWorkbook() @@ -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 diff --git a/inst/extdata/load_xlsx_testing.R b/inst/extdata/load_xlsx_testing.R index 36a8a43f..9a47b30e 100644 --- a/inst/extdata/load_xlsx_testing.R +++ b/inst/extdata/load_xlsx_testing.R @@ -1,4 +1,4 @@ - +# nolint start require('openxlsx') unzip_xlsx <- function(fl){ @@ -172,4 +172,4 @@ openXL(file.path(test_file_dir, "pivotTest.xlsx")) - +# nolint end diff --git a/inst/extdata/stack_style_testing.R b/inst/extdata/stack_style_testing.R index f60ad6d5..eb5d2ca4 100644 --- a/inst/extdata/stack_style_testing.R +++ b/inst/extdata/stack_style_testing.R @@ -1,4 +1,4 @@ - +# nolint start require('openxlsx') @@ -123,19 +123,4 @@ addStyle(wb, 3, createStyle(textDecoration = "bold", fgFill = "salmon"), 2:4, 2: openXL(wb) - - - - - - - - - - - - - - - - +# nolint end