navigation

IndexerAccessorStyleConsistency (FL0088)

Introduced in 0.26.10

Cause

Use of different styles of indexer accessors in the same codebase without consistency.

Rationale

F# 6.0 introduced a new style for indexer accessor, similar to the syntax of C#. But if your team is not convinced about this new style, you might want to make sure to stick with the previous OCaml style. Otherwise, you might want to convert all the accessors in your codebase to the new style. Consistency aides readability.

How To Fix

If the config style is OCaml use someArray.[0] and if the default style is CSharp use someArray[0].

Rule Settings

{
    "indexerAccessorStyleConsistency": {
        "enabled": false,
        "config": {
            "style": "OCaml"
        }
    }
}
  • style - chosen style for this convention: "OCaml" or "CSharp".