assignment

NoteAdded in 0.0.8

What it does

Checks for consistency of assignment operator.

Why is this bad?

In most cases using = and <- is equivalent. Some very popular packages use = without problems. This rule only ensures the consistency of the assignment operator in a project.

Configuration options

The operation of the assignment rule can be customised in the configuration file.

The lint.assignment.operator option in jarl.toml must be set for this rule to be checked. It takes a single value ("<-" or "=") indicating the preferred assignment operator in the files to check. If operator = "<-" then any use of the "=" operator to assign values will be reported, and vice-versa.

Default values

This option doesn’t have a default value.

TOML settings

[lint]
...

[lint.assignment]
operator = "<-" # or "="

Example

If the operator parameter is "=" then replace:

x <- "a"

by:

x = "a"

Note that Jarl will not report some cases where <- is used because it would change the meaning of code, e.g. this:

f(x <- 1)

cannot be replaced by:

f(x = 1)

References

See: