Green.Rules.Naming.AvoidCaps (green v0.2.0)

Copy Markdown

This module prints warnings when capital letters are used in atoms, functions, variables or attributes.

Configuration

This rule is enabled by default, but can be disabled globally in the configuration file.

In .formatter.exs:

green: [
  avoid_caps: [
    enabled: *true | false
  ]
]

Also, acceptable capitalized atoms can be configured with the accept_atoms option. This can be set globally in the configuration file or per-file using a comment.

In .formatter.exs:

green: [
  avoid_caps: [
    accept_atoms: [:Record, :MyApp.SpecialAtom]
  ]
]

In a file:

# green:configure-for-this-file Naming.AvoidCaps, accept_atoms: [:Record]

The rule can also be configured to ignore specific files, or specific lines in specific files:

green: [
  avoid_caps: [
    except: [
      "path/to/file.exs",
      {"path/to/other_file.exs", 42},
      {"path/to/yet_another_file.exs", [10, 20, 30]}
    ]
  ]
]