Skip to content

Commit a995da4

Browse files
authored
Add linting action (#2431)
Fixes #2430
1 parent b5d3534 commit a995da4

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

.github/workflows/lint.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: lint
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
19+
- uses: r-lib/actions/setup-r@v2
20+
with:
21+
use-public-rspm: true
22+
23+
- uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
packages: r-lib/lintr
26+
27+
- name: Lint
28+
run: |
29+
out <- lintr::lint_package()
30+
print(out)
31+
if (length(out)) stop("lints found")
32+
shell: Rscript {0}

.lintr

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
linters: funs <- c(
2+
# Base messaging
3+
"message" = "use cli::cli_inform()",
4+
"warning" = "use cli::cli_warn()",
5+
"stop" = "use cli::cli_abort()",
6+
# rlang messaging
7+
"inform" = "use cli::cli_inform()",
8+
"warn" = "use cli::cli_warn()",
9+
"abort" = "use cli::cli_abort()",
10+
# older cli
11+
"cli_alert_danger" = "use cli::cli_inform()",
12+
"cli_alert_info" = "use cli::cli_inform()",
13+
"cli_alert_success" = "use cli::cli_inform()",
14+
"cli_alert_warning" = "use cli::cli_inform()"
15+
)
16+
list(lintr::undesirable_function_linter(
17+
fun = funs,
18+
symbol_is_undesirable = FALSE
19+
))
20+
encoding: "UTF-8"

0 commit comments

Comments
 (0)