Learn R Programming

cleanr (version 1.1.3)

file_checks: File Checks

Description

A set of tiny functions to check that files adhere to a layout style. A file should have a clear layout, it should
  • mot have too many lines and
  • not have lines too wide.

Usage

check_file_width(path, max_file_width = gco("max_file_width"))
check_file_length(path, max_file_length = gco("max_file_length"))

Arguments

path
Path to the file to be checked.
max_file_width
The maximum line width accepted. Set (preferably via set_cleanr_options) to NULL or FALSE to disable the check.
max_file_length
The maximum number of lines accepted. Set (preferably via set_cleanr_options) to NULL or FALSE to disable the check.

Value

invisible(TRUE), but see Details.

Details

In case of a fail all file_checks throw a condition of class c("cleanr", "error", "condition").

Examples

Run this code
print(check_file_width(system.file("source", "R", "checks.R",
                                    package = "cleanr")))
print(check_file_length(system.file("source", "R", "checks.R",
                                    package = "cleanr"),
                                    max_file_length = 300))

Run the code above in your browser using DataLab