You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-4Lines changed: 19 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -177,9 +177,11 @@ The resulting configuration will contain each currently failing linter and the c
177
177
If you are developing a package, you can add `^\.lintr$` to your `.Rbuildignore` file using `usethis::use_build_ignore(".lintr")`.
178
178
179
179
## Continuous integration ##
180
-
You can configure `lintr` to run as part of continuous integration in order to automatically check that commits and pull requests do not deteriorate code style.
180
+
You can configure `lintr` to run as part of continuous integration (either for a package or a general project containing R files) in order to automatically check that commits and pull requests do not deteriorate code style.
181
181
182
-
### GitHub Actions ###
182
+
### For packages
183
+
184
+
#### GitHub Actions ###
183
185
184
186
If your package is on GitHub, the easiest way to do this is with GitHub Actions.
185
187
The workflow configuration files use YAML syntax. The `usethis` package has some
@@ -198,7 +200,7 @@ location, namely in the `.github/workflows` directory of your repository. This f
198
200
pull request with the lints found and they will also be printed as [annotations](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/about-status-checks#types-of-status-checks-on-github) along side the status check on GitHub. If you want to disable the commenting you can
199
201
set the environment variable `LINTR_COMMENT_BOT=false`.
200
202
201
-
### Travis CI ###
203
+
####Travis CI ###
202
204
203
205
If you want to run `lintr` on [Travis-CI](https://travis-ci.org), you will need
204
206
to have Travis install the package first. This can be done by adding the
@@ -216,7 +218,7 @@ add comments to the commit or pull request with the lints found and they will al
216
218
printed on Travis-CI. If you want to disable the commenting you can
217
219
set the environment variable `LINTR_COMMENT_BOT=false`.
218
220
219
-
#### Non-failing Lints ####
221
+
##### Non-failing Lints ####
220
222
```yaml
221
223
after_success:
222
224
- R CMD INSTALL $PKG_TARBALL
@@ -225,6 +227,19 @@ after_success:
225
227
226
228
Live example of a package using this setup: [`hibpwned`](https://github.com/lockedata/HIBPwned/blob/master/.travis.yml), [lintr-bot commenting on a PR](https://github.com/lockedata/HIBPwned/pull/30).
227
229
230
+
### For projects ###
231
+
232
+
You are not limited you using `lintr` for packages only, you can use it in combination with continuous integration for any other project.
233
+
234
+
#### GitHub Actions ####
235
+
236
+
If your project is on GitHub, you could take advantage of GitHub Actions and the `usethis` functionality. [r-lib/actions](https://github.com/r-lib/actions/tree/master/examples) includes a `lint-project` example, which you can use by calling:
237
+
238
+
```r
239
+
usethis::use_github_action("lint-project")
240
+
```
241
+
242
+
228
243
## Installation of development version ##
229
244
To install the latest development version of lintr from GitHub
0 commit comments