[R] Add lintr (#12902)

* add lintr

* update samples
This commit is contained in:
William Cheng 2022-07-17 17:29:05 +08:00 committed by GitHub
parent 7216899fe6
commit e05b9746ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 8 deletions

View File

@ -251,6 +251,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig {
supportingFiles.add(new SupportingFile("NAMESPACE.mustache", "", "NAMESPACE")); supportingFiles.add(new SupportingFile("NAMESPACE.mustache", "", "NAMESPACE"));
supportingFiles.add(new SupportingFile("testthat.mustache", File.separator + "tests", "testthat.R")); supportingFiles.add(new SupportingFile("testthat.mustache", File.separator + "tests", "testthat.R"));
supportingFiles.add(new SupportingFile("r-client.mustache", File.separator + ".github" + File.separator + "workflows", "r-client.yaml")); supportingFiles.add(new SupportingFile("r-client.mustache", File.separator + ".github" + File.separator + "workflows", "r-client.yaml"));
supportingFiles.add(new SupportingFile("lintr.mustache", "", ".lintr"));
// add lambda for mustache templates to fix license field // add lambda for mustache templates to fix license field
additionalProperties.put("lambdaLicense", new Mustache.Lambda() { additionalProperties.put("lambdaLicense", new Mustache.Lambda() {

View File

@ -0,0 +1,6 @@
linters: linters_with_defaults(
line_length_linter(160),
object_name_linter = NULL
)
exclusions: list(
)

View File

@ -21,10 +21,10 @@ jobs:
use-public-rspm: true use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2 - uses: r-lib/actions/setup-r-dependencies@v2
with: with:
extra-packages: any::rcmdcheck extra-packages: any::rcmdcheck, any::roxygen2, any::lintr, local::.
needs: check needs: check, roxygen2, lint
- name: Install roxygen2 - name: Lint
run: install.packages("roxygen2") run: lintr::lint_package()
shell: Rscript {0} shell: Rscript {0}
- name: Roxygenize - name: Roxygenize
run: | run: |

View File

@ -21,10 +21,10 @@ jobs:
use-public-rspm: true use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2 - uses: r-lib/actions/setup-r-dependencies@v2
with: with:
extra-packages: any::rcmdcheck extra-packages: any::rcmdcheck, any::roxygen2, any::lintr, local::.
needs: check needs: check, roxygen2, lint
- name: Install roxygen2 - name: Lint
run: install.packages("roxygen2") run: lintr::lint_package()
shell: Rscript {0} shell: Rscript {0}
- name: Roxygenize - name: Roxygenize
run: | run: |

View File

@ -0,0 +1,6 @@
linters: linters_with_defaults(
line_length_linter(160),
object_name_linter = NULL
)
exclusions: list(
)

View File

@ -1,6 +1,7 @@
.Rbuildignore .Rbuildignore
.github/workflows/r-client.yaml .github/workflows/r-client.yaml
.gitignore .gitignore
.lintr
.travis.yml .travis.yml
DESCRIPTION DESCRIPTION
NAMESPACE NAMESPACE