navigation

NoPartialFunctions (FL0066)

Cause

A partial function was used.

Rationale

Partial functions are only valid for certain inputs; for invalid inputs they will throw an exception. In most cases, it is better to use a non-partial version of the function (e.g. List.tryFind instead of List.find) or use pattern matching, so that you need to explicitly handle those cases which would cause an exception in the partial version.

How To Fix

Use non-partial function or pattern matching.

Rule Settings

{
    "noPartialFunctions": {
        "enabled": false,
        "config": {
          "allowedPartials": [],
          "additionalPartials": []
        }
    }
}
  • allowedPartials - list of strings representing partial functions to allow (e.g. "List.tryFind")
  • additionalPartials - list of strings representing additional partial functions to disallow