Maintainability · rule layer-naming-mismatch
dbt layer naming: inconsistent model prefixes
A Metacenta review checks this under the rule Layer naming is applied consistently. Everything below applies whether or not you ever commission one.
What this rule checks
Within each staging/, intermediate/ and marts directory, this rule flags models missing the prefix at least half of that directory uses. Marts directories are marts, mart, presentation and reporting. Where fewer than half use the prefix, we report the split once, as information.
Why it matters
Inconsistent naming means a reader cannot tell a model's layer from its name, and that slows every hand-off. The mix costs more than either convention would on its own.
How to fix it
Apply the layer naming convention consistently. Rename the model to the prefix the rest of its directory uses, or move it to the layer it belongs in. Where we report a split, decide which style is current and rename the minority.
Before:
-- models/staging/stg_customers.sql
-- models/staging/stg_orders.sql
-- models/staging/payments.sql
After:
-- models/staging/stg_customers.sql
-- models/staging/stg_orders.sql
-- models/staging/stg_payments.sql
When it is fine to leave
A project laid out by domain rather than by layer is not judged. A directory where no model uses a prefix is left alone, and so is metricflow_time_spine. Staging accepts stg_ or base_; marts accepts dim_, fct_, fact_, mart_, rpt_ or agg_.
What we need to check it
manifest.json alone, for each model's name and file path. We decline when no layer directory applies a prefix, because there is no house convention to hold models to.
Published rules it corresponds to
dbt_project_evaluator, rule fct_model_naming_conventions. Ours checks the same concern, tested differently. both check that a model's name matches the layer it sits in; the prefixes each treats as canonical are not identical.
This means our check corresponds to their rule. It does not mean the publisher reviewed or endorses it.