Skip to contents

While .1 and 0.1 mean the same thing, the latter is easier to read due to the small size of the '.' glyph.

Usage

numeric_leading_zero_linter()

See also

linters for a complete list of linters available in lintr.

Examples

# will produce lints
lint(
  text = "x <- .1",
  linters = numeric_leading_zero_linter()
)
#> ::warning file=<text>,line=1,col=6::file=<text>,line=1,col=6,[numeric_leading_zero_linter] Include the leading zero for fractional numeric constants.

lint(
  text = "x <- -.1",
  linters = numeric_leading_zero_linter()
)
#> ::warning file=<text>,line=1,col=7::file=<text>,line=1,col=7,[numeric_leading_zero_linter] Include the leading zero for fractional numeric constants.

# okay
lint(
  text = "x <- 0.1",
  linters = numeric_leading_zero_linter()
)

lint(
  text = "x <- -0.1",
  linters = numeric_leading_zero_linter()
)