File: expect_not_linter.Rd

package info (click to toggle)
r-cran-lintr 3.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 4,396 kB
  • sloc: sh: 13; xml: 10; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 1,141 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expect_not_linter.R
\name{expect_not_linter}
\alias{expect_not_linter}
\title{Require usage of \code{expect_false(x)} over \code{expect_true(!x)}}
\usage{
expect_not_linter()
}
\description{
\code{\link[testthat:logical-expectations]{testthat::expect_false()}} exists specifically for testing that an output is
\code{FALSE}. \code{\link[testthat:logical-expectations]{testthat::expect_true()}} can also be used for such tests by
negating the output, but it is better to use the tailored function instead.
The reverse is also true -- use \code{expect_false(A)} instead of
\code{expect_true(!A)}.
}
\examples{
# will produce lints
lint(
  text = "expect_true(!x)",
  linters = expect_not_linter()
)

# okay
lint(
  text = "expect_false(x)",
  linters = expect_not_linter()
)

}
\seealso{
\link{linters} for a complete list of linters available in lintr.
}
\section{Tags}{
\link[=best_practices_linters]{best_practices}, \link[=package_development_linters]{package_development}, \link[=pkg_testthat_linters]{pkg_testthat}, \link[=readability_linters]{readability}
}