Current section
Files
Jump to
Current section
Files
rebar.config
{erl_opts, [
debug_info,
warnings_as_errors,
warn_unused_vars,
warn_shadow_vars,
warn_obsolete_guard
]}.
{minimum_otp_vsn, "27"}.
%% `telemetry` is declared as a runtime-optional dep:
%% * It is fetched and compiled by `rebar3 deps` so handlers in the
%% consumer can attach.
%% * The lib itself never assumes `telemetry` is loaded — see
%% `erli18n_telemetry.erl` for the `code:ensure_loaded/1` guard
%% pattern that turns every emit into a no-op when the module is
%% missing. See the `erli18n_telemetry` module docs for the rationale.
%%
%% Naming/version policy: telemetry 1.x is the stable line maintained by
%% the BEAM Telemetry WG (https://github.com/beam-telemetry/telemetry).
%% Version constraint is intentionally loose to interoperate with the
%% consumer's existing dep tree (Phoenix, Ecto, Oban, etc. all pull 1.x).
{deps, [
{telemetry, "~> 1.3"}
]}.
{shell, [{apps, [erli18n]}]}.
%% Quality-gate plugins. Invoked via `bin/quality-gate.sh` (manual or git
%% hooks). Each plugin is build-only — no runtime impact on the lib.
%%
%% * `erlfmt` — canonical formatter (WhatsApp/Meta; Apache-2.0).
%% * `rebar3_hank` — dead code detector (AdRoll; Apache-2.0).
%% * `rebar3_lint` — Elvis style checker (Inaka; Apache-2.0).
%% * `rebar3_ex_doc` — generates HexDocs-style HTML from the native
%% `-doc` attributes (Erlang/OTP 27+). Run `rebar3 ex_doc` locally to
%% build the docs; `rebar3 hex publish docs` ships them to HexDocs
%% (requires a Hex account — out of scope for now).
%% * `rebar3_hex` — Hex.pm packaging/publishing (also drives the
%% `rebar3 hex publish docs` flow above).
%%
%% Note on eqWAlizer (Meta's gradual type checker): it is NOT a rebar3
%% plugin. It runs via the `elp` CLI (Erlang Language Platform). The
%% quality-gate script invokes `elp eqwalize-all` when elp is on PATH;
%% otherwise the step is skipped with a hint. See
%% https://whatsapp.github.io/eqwalizer/getting-started/ for elp install.
{project_plugins, [
{erlfmt, "~> 1.5"},
{rebar3_hank, "~> 1.4"},
{rebar3_lint, "~> 3.2"},
{rebar3_hex, "~> 7.0"},
{rebar3_ex_doc, "~> 0.2"}
]}.
%% erlfmt scope. The plugin is invoked with `--check` (CI) or `--write`
%% (auto-fix) from the quality-gate script.
{erlfmt, [
{files, ["{src,test}/*.{erl,app.src}", "rebar.config"]}
]}.
%% ExDoc config (extras + main page + source URL). This block is the single
%% source of truth for the doc options; `scripts/gen_docs.sh` reads it (via
%% scripts/ex_doc_config.escript) and renders the HTML site straight from the
%% native `-doc`/`-moduledoc` BEAM chunks (EEP-48) using the ex_doc escript.
%%
%% NOTE: `rebar3 ex_doc` is currently unusable for this project. The plugin
%% always runs EDoc to generate chunks first, and EDoc's legacy wiki parser
%% throws on a Markdown backtick in an ordinary `%%` comment — an upstream bug
%% (see notes/edoc-exdoc-native-doc-bug.md). `scripts/gen_docs.sh` skips that
%% vestigial EDoc step (ex_doc reads the docs from the BEAM, not from EDoc's
%% chunks). `rebar3 hex publish docs` is affected by the same upstream bug.
{ex_doc, [
{extras, [
"README.md",
"CHANGELOG.md",
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md",
"SECURITY.md",
"LICENSE"
]},
{main, "readme"},
{source_url, "https://github.com/eagle-head/erli18n"},
{prefix_ref_vsn_with_v, false}
]}.
%% Hex packaging. Wire the doc provider to ExDoc so that
%% `rebar3 hex publish docs` renders the site via `rebar3_ex_doc`.
{hex, [{doc, #{provider => ex_doc}}]}.
%% Test-only deps: PropEr (property-based + fuzzing harness) and
%% `eqwalizer_support` (the `eqwalizer:dynamic_cast/1` helper used at
%% PropEr generator boundaries — see the note on its dep below).
%%
%% * PropEr (Apache-2.0; https://hexdocs.pm/proper/) is the canonical
%% QuickCheck implementation for Erlang (Papadakis et al., PADL 2011
%% https://proper-testing.github.io/papers/proper_acm.pdf). The
%% `~> 1.4` constraint pins PropEr to >= 1.4; the latest stable
%% line at the time of writing is 1.5.x.
%%
%% The parity oracle is NOT a rebar dependency: `erli18n_parity_SUITE`
%% shells out to the real GNU gettext CLI (`msgfmt`, `gettext`,
%% `ngettext`) installed on the system, and skips its scenarios cleanly
%% when that toolchain — or the required UTF-8 locales — is absent.
{profiles, [
{test, [
{deps, [
{proper, "~> 1.4"},
%% `eqwalizer_support` provides the `eqwalizer:dynamic_cast/1`
%% helper used at PropEr-generator boundaries (where the
%% statically-inferred type is `term()` by design). At runtime
%% the function is the identity, so the module is a no-op
%% outside of type-checking. Sourced from the WhatsApp/Meta
%% eqwalizer repo (Apache-2.0) since the package is not
%% published to Hex. See
%% https://github.com/whatsapp/eqwalizer/tree/main/eqwalizer_support.
{eqwalizer_support,
{git_subdir, "https://github.com/whatsapp/eqwalizer.git", {branch, "main"},
"eqwalizer_support"}}
]}
]}
]}.
%% Dialyzer needs PLT entries for telemetry if it's available — adding it
%% to plt_extra_apps keeps `rebar3 dialyzer` warning-free when the dep is
%% present. The lib still compiles without it because every call site is
%% guarded by `erli18n_telemetry:emit/3,4` indirection.
{dialyzer, [
{warnings, [unknown]},
{plt_extra_apps, [telemetry]}
]}.
%% Xref: we drop `unused_exports` from the default set. erli18n is a
%% publishable library — every public function exists for external
%% consumers (or for test/property suites that xref doesn't scan), so
%% "unused export" inside the lib is the norm, not a defect. We keep
%% the checks that catch genuine bugs.
{xref_checks, [
undefined_function_calls,
undefined_functions,
locals_not_used,
deprecated_function_calls,
deprecated_functions
]}.
%% Hank (dead code detector) — silence ONLY false positives, leaving
%% real rules (unused_includes, unused_macros, unused_record_fields)
%% active for all files:
%% * `unnecessary_function_arguments` for CT/PropEr test files — these
%% functions must take Config/_/etc args per the behaviour contract,
%% even when the test doesn't use them.
{hank, [
{ignore, [
{"test/*_SUITE.erl", [unnecessary_function_arguments]}
]}
]}.