% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expect_null_linter.R
\name{expect_null_linter}
\alias{expect_null_linter}
\title{Require usage of \code{expect_null} for checking \code{NULL}}
\usage{
expect_null_linter()
}
\description{
Require usage of \code{expect_null(x)} over \code{expect_equal(x, NULL)} and similar
usages.
}
\details{
\code{\link[testthat:expect_null]{testthat::expect_null()}} exists specifically for testing for \code{NULL} objects.
\code{\link[testthat:expect_equal]{testthat::expect_equal()}}, \code{\link[testthat:expect_identical]{testthat::expect_identical()}}, and
\code{\link[testthat:expect_true]{testthat::expect_true()}} can also be used for such tests,
but it is better to use the tailored function instead.
}
\examples{
# will produce lints
lint(
  text = "expect_equal(x, NULL)",
  linters = expect_null_linter()
)

lint(
  text = "expect_identical(x, NULL)",
  linters = expect_null_linter()
)

lint(
  text = "expect_true(is.null(x))",
  linters = expect_null_linter()
)


# okay
lint(
  text = "expect_null(x)",
  linters = expect_null_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}
}
