Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove mentions of lintr-bot #1902

Merged
merged 4 commits into from
Jan 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions vignettes/continuous-integration.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@ usethis::use_github_action("lint")
This will create a workflow file called `lint.yaml` and place it in the correct location, namely in the `.github/workflows` directory of your repository.
This file configures all the steps required to run `lintr::lint_package()` on your package.

[lintr-bot](https://github.com/lintr-bot) will then add comments to the commit or pull request with the lints found and they will also be printed as
Alternatively you can use the eponymous [`lint-changed-files.yaml`](https://github.com/r-lib/actions/blob/v2-branch/examples/lint-changed-files.yaml) to only lint any changed files:

```r
usethis::use_github_action("lint-changed-files")
```

Comments to the commit or pull request will 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 set the environment variable `LINTR_COMMENT_BOT=false`.
Additionally, if you want the builds to produce an error instead of just a warning, you can set the environment variable `LINTR_ERROR_ON_LINT=true`.
If you want the builds to produce an error instead of just a warning, you can set the environment variable `LINTR_ERROR_ON_LINT=true`.
This is set by default for both [r-lib/actions](https://github.com/r-lib/actions/)'s `lint.yaml` and `lint-changed-files.yaml`.
Note that this will kill the R process in case of a lint.

If your project is in a subdirectory and you would like to use GitHub Actions annotations, you can set
Expand All @@ -53,27 +59,20 @@ r_github_packages:
- r-lib/lintr
```

We recommend running `lintr::lint_package()` as an [after_success step in your build process](#non-failing-lints)]

Just like with GitHub Actions, [lintr-bot](https://github.com/lintr-bot) will then add comments to the commit or pull request with the lints found and
they will also be printed on Travis-CI.
The environment variables `LINTR_COMMENT_BOT` and `LINTR_ERROR_ON_LINT` mentioned for GitHub actions also work with Travis CI builds.

##### Non-failing Lints {#non-failing-lints}
We recommend running `lintr::lint_package()` as an after_success step in your build process:

``` yaml
after_success:
- R CMD INSTALL $PKG_TARBALL
- Rscript -e 'lintr::lint_package()'
```

Live example of a package using this setup:
[`hibpwned`](https://github.com/jumpingrivers/HIBPwned/blob/master/.travis.yml),
[lintr-bot commenting on a PR](https://github.com/jumpingrivers/HIBPwned/pull/30).
If lints are found in the commit or pull request they will be printed on Travis-CI.
The environment variable `LINTR_ERROR_ON_LINT` mentioned for GitHub actions also works with Travis CI builds.

## For projects

You are not limited you using `lintr` for packages -- you can use it in combination with continuous integration for any other project.
You are not limited to using `lintr` for packages -- you can use it in combination with continuous integration for any other project.

### GitHub Actions

Expand Down