# `Bylaw.Credo.Check.Elixir.AppModuleAcronymCasing`
[🔗](https://github.com/ryanzidago/bylaw/blob/v0.1.0-alpha.1/lib/bylaw/credo/check/elixir/app_module_acronym_casing.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) via `.credo.exs`.

This check has a base priority of `high` and works with any version of Elixir.

## Explanation

App-owned module names should use uppercase acronym words such as `API`,
`CSV`, `HTTP`, `JSON`, `LLM`, and `UUID`.

## Examples

Avoid:

      defmodule MyAppWeb.Api.V1.ToolController do
        alias MyApp.Accounts.TenantApiKey
        alias MyApp.TestSupport.ExAwsHttpClient
        alias MyApp.DatabaseCheck.UuidKeys
      end

Prefer:

      defmodule MyAppWeb.API.V1.ToolController do
        alias MyApp.Accounts.TenantAPIKey
        alias MyApp.TestSupport.ExAwsHTTPClient
        alias MyApp.DatabaseCheck.UUIDKeys
      end

Mix task modules are exempt because the project intentionally keeps names
such as `Mix.Tasks.Qa`.

## Notes

This check uses static AST analysis, so it favors clear source-level patterns over runtime behavior.
Configure `:app_roots` for the application module roots that should be checked.

## Options

Configure options in `.credo.exs` with the check tuple:

```elixir
%{
  configs: [
    %{
      name: "default",
      checks: [
        {Bylaw.Credo.Check.Elixir.AppModuleAcronymCasing,
         [
           acronyms: ~w(API CSV HTTP JSON UUID),
           app_roots: ~w(MyApp MyAppWeb),
           exempt_prefixes: ~w(Mix.Tasks),
           relative_roots: ~w(api admin)
         ]}
      ]
    }
  ]
}
```

- `:acronyms` - Uppercase acronym words to enforce in app-owned module names.
- `:app_roots` - Absolute app module roots that should be checked. Defaults to an empty list, so consumer applications should configure their own roots.
- `:exempt_prefixes` - Module prefixes that should always be ignored.
- `:relative_roots` - Relative module roots to check inside app-owned modules.

## Usage

Add this check to Credo's `checks:` list in `.credo.exs`:

```elixir
%{
  configs: [
    %{
      name: "default",
      checks: [
        {Bylaw.Credo.Check.Elixir.AppModuleAcronymCasing,
         [
           app_roots: ~w(MyApp MyAppWeb)
         ]}
      ]
    }
  ]
}
```

## Check-Specific Parameters

Use the following parameters to configure this check:

### `:acronyms`

  Uppercase acronym words to enforce in app-owned module names.

*This parameter defaults to* `["API", "CSV", "HTTP", "JSON", "LLM", "UUID"]`.

### `:app_roots`

  Absolute app module roots that should be checked. Defaults to an empty list.

*This parameter defaults to* `[]`.

### `:exempt_prefixes`

  Module prefixes that should always be ignored.

*This parameter defaults to* `["Mix.Tasks"]`.

### `:relative_roots`

  Relative module roots to check inside app-owned modules.

*This parameter defaults to* `["api"]`.

## General Parameters

Like with all checks, [general params](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
