Jarl
Configuration for R linter
| Type | object |
|---|---|
| File match |
jarl.toml
|
| Schema URL | https://catalog.lintel.tools/schemas/schemastore/jarl/latest.json |
| Source | https://github.com/etiennebacher/jarl/releases/latest/download/jarl.schema.json |
Validate with Lintel
npx @lintel/lintel check
Properties
Definitions
Accepts either the legacy top-level string (assignment = "<-") or the new
table form ([lint.assignment] with an operator field).
TOML doesn't allow a key to be both a string and a table, but by trying the table form first we can surface clear errors (like "unknown field") while still falling back to the legacy string form.
TOML options for [lint.assignment].
Use operator to specify which assignment operator to enforce.
Valid values are "<-" (the default) and "=".
TOML options for [lint.duplicated_arguments].
Use skipped-functions to fully replace the default list of functions
that are allowed to have duplicated arguments. Use
extend-skipped-functions to add to the default list.
Specifying both is an error.
TOML options for [lint.implicit_assignment].
Use skipped-functions to fully replace the default list of functions
where implicit assignments are allowed. Use
extend-skipped-functions to add to the default list.
Specifying both is an error.
Accepts either the legacy form assignment = "<-" (deprecated) or the
new table form [lint.assignment] with an operator field.
When enabled, Jarl parses and checks R code found in roxygen2
@examples and @examplesIf documentation sections. Only applies to
files inside an R package (i.e. in the R/ directory with a
DESCRIPTION file in the parent).
Defaults to true.
Jarl automatically excludes a default set of folders and files. If this option is
set to false, these files will be formatted as well.
The default set of excluded patterns are:
.git/renv/revdep/cpp11.RRcppExports.Rextendr-wrappers.Rimport-standalone-*.R
Use skipped-functions to fully replace the default list of functions
that are allowed to have duplicated arguments. Use
extend-skipped-functions to add to the default list.
Specifying both is an error.
By default, jarl will refuse to check files matched by patterns listed in
default-exclude. Use this option to supply an additional list of exclude
patterns.
Exclude patterns are modeled after what you can provide in a
.gitignore, and are resolved relative to the
parent directory that your jarl.toml is contained within. For example, if your
jarl.toml was located at root/jarl.toml, then:
-
file.Rexcludes a file namedfile.Rlocated anywhere belowroot/. This is equivalent to**/file.R. -
folder/excludes a directory namedfolder(and all of its children) located anywhere belowroot/. You can also just usefolder, but this would technically also match a file namedfolder, so the trailing slash is preferred when targeting directories. This is equivalent to**/folder/. -
/file.Rexcludes a file namedfile.Rlocated atroot/file.R. -
/folder/excludes a directory namedfolder(and all of its children) located atroot/folder/. -
file-*.Rexcludes R files named likefile-this.Randfile-that.Rlocated anywhere belowroot/. -
folder/*.Rexcludes all R files located atroot/folder/. Note that R files in directories underfolder/are not excluded in this case (such asroot/folder/subfolder/file.R). -
folder/**/*.Rexcludes all R files located anywhere belowroot/folder/. -
**/folder/*.Rexcludes all R files located directly inside afolder/directory, where thefolder/directory itself can appear anywhere.
See the full .gitignore documentation for all of the patterns you can provide.
This is a list of rule names to add on top of the existing selection.
This is useful in the case where you want to use the default set of
rules and some additional opt-in rules. In this scenario, you only
need to add extend-select = ["OPT_IN_RULE"] instead of writing all
default rule names.
This has the same constraints as select.
When enabled, Jarl will attempt to apply fixes to R code inside
roxygen2 @examples and @examplesIf sections. Since Air does not
currently support formatting roxygen examples, this is opt-in.
Defaults to false.
A list of rules for which violations will be fixed if possible. By
default, all rules are considered fixable.
This only matters if you pass --fix in the CLI.
If this is empty, then no rules are excluded. This field has higher
importance than select, so if a rule name appears by mistake in both
select and ignore, it is ignored.
Use skipped-functions to fully replace the default list of functions
that are allowed to contain implicit assignment. Use
extend-skipped-functions to add to the default list.
Specifying both is an error.
By default, jarl checks all files with a .R, .qmd, .Rmd, or .rmd
extension discovered in the provided paths. Use this option to restrict
checking to files that match at least one of the supplied patterns. An
empty list or a missing option means no restriction, i.e. all discovered
files are checked.
Include patterns follow the same format as exclude patterns (gitignore
style, resolved relative to the jarl.toml directory). For example:
-
R/only checks files inside theR/directory. -
test-*.Ronly checks files whose name matchestest-*.R. -
**/*.{Rmd,qmd}only checks Rmd and qmd files.
When both include and exclude are specified, a file is checked only
if it matches at least one include pattern and does not match any
exclude pattern.
If this is empty, then all rules that are provided by jarl are used,
with one limitation related to the minimum R version used in the project.
By default, if this minimum R version is unknown, then all rules that
have a version restriction are deactivated. This is for example the case
of grepv since the eponymous function was introduced in R 4.5.0.
There are three ways to inform jarl about the minimum version used in
the project:
- pass the argument
--min-r-versionin the CLI, e.g.,jarl --min-r-version 4.3; - if the project is an R package, then
jarllooks for mentions of a minimum R version in theDependsfield sometimes present in theDESCRIPTIONfile. - specify
min-r-versioninjarl.toml.
Use functions to fully replace the default list of undesirable functions.
Use extend-functions to add to the default list.
Specifying both is an error.
A list of rules that are never fixed. This only matters if you pass
--fix in the CLI.
Use stopping-functions to fully replace the default list of functions
that are considered to stop execution (never return). Use
extend-stopping-functions to add to the default list.
Specifying both is an error.
Use threshold-ignore to control how many unused_function
violations are allowed before they are all hidden (likely false
positives).
Use skipped-functions to determine which functions won't be reported
even if Jarl considers them unused.
TOML options for [lint.undesirable_function].
Use functions to fully replace the default list of undesirable functions.
Use extend-functions to add to the default list.
Specifying both is an error.
TOML options for [lint.unreachable_code].
Use stopping-functions to fully replace the default list of functions
that are considered to stop execution (never return). Use
extend-stopping-functions to add to the default list.
Specifying both is an error.
TOML options for [lint.unused_function].
Use threshold-ignore to control when unused_function
diagnostics are hidden. When the number of violations exceeds this
threshold, they are suppressed with an informative note (likely false
positives).
Use skipped-functions to provide a list of regex patterns for
functions that should be skipped by this rule.