Skip to content

Commit cdc9a80

Browse files
committed
r-lintr: add lintr support
1 parent 3074622 commit cdc9a80

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

.pre-commit-hooks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@
4747
description: 'Prints any TODOs tagged with the ticket reference in the current branch name'
4848

4949
- id: branch-name-check
50-
name: 'Checks branch names obeys the following regex: ^(feature|bugfix|release|hotfix)\/.+'
50+
name: 'Checks branch name obeys the standardised format'
5151
entry: run-branch-name-check.sh
5252
always_run: true
5353
pass_filenames: false
5454
language: 'script'
5555
minimum_pre_commit_version: 0.15.0
56-
description: 'Checks branch names obeys the following regex: ^(feature|bugfix|release|hotfix)\/.+'
56+
description: 'Checks branch names obeys the following regex'
5757

5858
# A copy of
5959
# https://github.com/golangci/golangci-lint/commit/09677d574ea6cd05141022aa90b88b6598bfa1a1

run-r-lintr.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
#!/usr/bin/env Rscript
22

33
files <- commandArgs(trailingOnly=TRUE)
4+
stop <- FALSE
45
tryCatch(
56
{
67
for (f in files) {
7-
lintr::lint(f)
8+
errors <- lintr::lint(f)
9+
if (length(errors) > 0) {
10+
print(errors)
11+
stop <- TRUE
12+
}
813
}
914
},
1015
warning = function(w) stop(conditionMessage(w), call. = FALSE)
11-
)
16+
)
17+
if (stop) {
18+
stop("lintr failures found")
19+
}

0 commit comments

Comments
 (0)