Skip to main content
Version: 0.0.6

Diagnostics

Vapour checks your code before transpiling it, these checks are reported as diagnostics, in your editor via the LSP or in the terminal when using the CLI.

Format​

In the terminal, diagnostics are printed as:

[SEVERITY]	file:line:column message

e.g.:

[WARN]	script.vp:4:23 `n` might be missing
✓ files successfully transpiled!
info

Line numbers currently start at 0 in the terminal output.

Severities​

SeverityMeaningPrevents transpilation
ERRORThe code is invalid, or will failYes
WARNThe code will probably failNo
INFOSomething is likely a mistakeNo
HINTThe code could be improvedNo

Use -check-only to only run the checks, see CLI. You can choose which severities are shown in your editor, see customise.

Errors​

Errors prevent transpilation.

Declarations

  • variable is already declared
  • function or type is already defined
  • functions and types cannot share a name
  • function shares its name with a base R function
  • type is not declared
  • constants without a value, or with multiple types
  • assigning to a constant
  • assigning to a parent variable (<-) that does not exist

Types

  • assigning a value of the wrong type
  • returning a value of the wrong type, or not returning (except null functions)
  • vectors mixing types, e.g.: (1, "a")
  • using $ on a vector type
  • unknown attribute on an object, or attribute of the wrong type
  • looping over a type that cannot be iterated

Functions & methods

  • argument of the wrong type
  • unknown named argument, or too many arguments
  • duplicated parameter
  • callback that does not match its signature
  • method on any outside of @generic and @default

Objects

  • object, struct and environment attributes must be named
  • struct expects an unnamed first argument
  • list, factor, and vectors expect unnamed arguments
  • unexpected decorator argument, e.g.: @matrix(foo = 1)

Warnings​

  • variable not found, e.g.: print(x) where x is not declared
  • argument might be missing, see missing check

Info​

  • variable or type is never used
  • comparison between types that are not comparable, e.g.: "a" > 1
  • the same method is defined twice on a type

Hints​

  • package is not installed
  • function is not exported by the package, e.g.: dplyr::foo()
  • use of library() or require(), prefer namespace::foo