# tabulareditor/bestpracticerules architecture

> Architecture diagram of the GitHub repository tabulareditor/bestpracticerules, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tabulareditor/bestpracticerules
- Repository: https://github.com/tabulareditor/bestpracticerules

## Overview

1. This repository is not an application runtime; it is a content repository for Tabular Editor’s Best Practice Analyzer. Its main product is a set of JSON rule packs that Tabular Editor loads as model-analysis rules.

2. The top-level packaged artifacts are `BPARules-standard.json`, `BPARules-standard-lax.json`, `BPARules-contrib.json`, and `BPARules-PowerBI.json`. These are the distributable outputs meant for end users and releases.

3. The source of truth lives under `src/standard/`, where rules are stored as individual JSON files. This keeps each rule independently reviewable and maintainable rather than editing one large monolithic file.

4. The source rules are organized by analyzer category, which maps directly to the repository’s architecture: `DAX Expressions`, `Formatting`, `Metadata`, `Model Layout`, `Naming Conventions`, and `Performance`. Each category is a logical subsystem of best-practice checks.

5. Every rule follows a shared schema described in the README: `ID`, `Name`, `Category`, `Description`, `Severity`, `Scope`, `Expression`, optional `FixExpression`, and optional `Remarks`. The key execution logic is the Dynamic LINQ `Expression`, which Tabular Editor evaluates against model objects.

6. The repo’s functional boundary is clear: it does not execute analysis itself. Tabular Editor is the consumer, loading these JSON definitions and applying them to tabular model metadata and DAX expressions inside the model.

7. The build folder contains two PowerShell scripts, `combine-rules.ps1` and `split-rules.ps1`. These indicate a simple packaging pipeline: split a combined ruleset into per-rule files for source control, then combine source files back into release-ready JSON bundles.

8. The `standard` ruleset appears to be the primary maintained baseline. The presence of `standard-lax`, `contrib`, and `PowerBI` packages suggests multiple curated distributions with different strictness or scope, likely assembled from the same rule-fragment pattern.

9. The rules themselves target different layers of a tabular model: DAX formula quality, metadata behavior, model layout/visibility, naming consistency, and performance-related modeling choices. That means the repository covers both semantic correctness and authoring conventions.

10. The external ecosystem boundary is Tabular Editor and the Best Practice Analyzer wiki referenced in the README. Users install a packaged `BPARules.json` into a local Tabular Editor directory, so the repo’s output is effectively a configuration artifact consumed by a desktop modeling tool.

11. For an architecture diagram, the key flow is: individual rule JSON files in `src/standard/` -> build scripts combine them -> release artifacts at the repo root -> Tabular Editor loads them -> BPA evaluates tabular model objects using Dynamic LINQ -> results are shown to the model author.

12. In short, this repository is a rules-engine content pack with no service layer, database, or UI of its own; its architecture is centered on rule definition, packaging, and distribution to a single downstream consumer.

Main entry points: [`src/standard`](https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard) (Standard rules), [`README.md`](https://github.com/tabulareditor/bestpracticerules/blob/master/README.md) (Rule schema), [`build/combine-rules.ps1`](https://github.com/tabulareditor/bestpracticerules/blob/master/build/combine-rules.ps1) (Combine rules), [`src/standard/DAX Expressions`](https://github.com/tabulareditor/bestpracticerules/tree/HEAD/src/standard/DAX%20Expressions) (DAX Expressions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_source["Source rules"]
  node_standard_src[("Standard rules<br/>source ruleset")]
  node_dax_cat["DAX Expressions<br/>category"]
  node_fmt_cat["Formatting<br/>category"]
  node_meta_cat["Metadata<br/>category"]
  node_layout_cat["Model Layout<br/>category"]
  node_naming_cat["Naming Conventions<br/>category"]
  node_perf_cat["Performance<br/>category"]
  node_rule_schema["Rule schema<br/>json schema<br/>[README.md]"]
end

subgraph group_build["Build & packaging"]
  node_build_combine["Combine rules<br/>powershell script<br/>[combine-rules.ps1]"]
  node_build_split["Split rules<br/>powershell script<br/>[split-rules.ps1]"]
end

subgraph group_release["Release bundles"]
  node_root_standard["Standard pack<br/>ruleset bundle"]
  node_root_standard_lax["Standard lax<br/>ruleset bundle"]
  node_root_contrib["Contrib pack<br/>ruleset bundle"]
  node_root_powerbi["PowerBI pack<br/>ruleset bundle"]
end

subgraph group_consumer["Downstream consumer"]
  node_tabular_editor(("Tabular Editor<br/>desktop consumer"))
  node_bpa_engine(("BPA engine<br/>analyzer runtime"))
  node_dynamic_linq{{"Dynamic LINQ<br/>expression language"}}
  node_model_objects[("Tabular model<br/>analysis target")]
end

node_standard_src -->|"contains"| node_dax_cat
node_standard_src -->|"contains"| node_fmt_cat
node_standard_src -->|"contains"| node_meta_cat
node_standard_src -->|"contains"| node_layout_cat
node_standard_src -->|"contains"| node_naming_cat
node_standard_src -->|"contains"| node_perf_cat
node_dax_cat -->|"uses"| node_rule_schema
node_fmt_cat -->|"uses"| node_rule_schema
node_meta_cat -->|"uses"| node_rule_schema
node_layout_cat -->|"uses"| node_rule_schema
node_naming_cat -->|"uses"| node_rule_schema
node_perf_cat -->|"uses"| node_rule_schema
node_build_split -->|"extracts"| node_standard_src
node_build_combine -->|"assembles"| node_root_standard
node_build_combine -->|"assembles"| node_root_standard_lax
node_build_combine -->|"assembles"| node_root_contrib
node_build_combine -->|"assembles"| node_root_powerbi
node_root_standard -->|"loaded by"| node_tabular_editor
node_root_standard_lax -->|"loaded by"| node_tabular_editor
node_root_contrib -->|"loaded by"| node_tabular_editor
node_root_powerbi -->|"loaded by"| node_tabular_editor
node_tabular_editor -->|"hosts"| node_bpa_engine
node_bpa_engine -->|"evaluates"| node_dynamic_linq
node_dynamic_linq -->|"queries"| node_model_objects
node_bpa_engine -->|"analyzes"| node_model_objects

click node_root_standard "https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-standard.json"
click node_root_standard_lax "https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-standard-lax.json"
click node_root_contrib "https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-contrib.json"
click node_root_powerbi "https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-PowerBI.json"
click node_build_combine "https://github.com/tabulareditor/bestpracticerules/blob/master/build/combine-rules.ps1"
click node_build_split "https://github.com/tabulareditor/bestpracticerules/blob/master/build/split-rules.ps1"
click node_standard_src "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard"
click node_dax_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/DAX Expressions"
click node_fmt_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Formatting"
click node_meta_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Metadata"
click node_layout_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Model Layout"
click node_naming_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Naming Conventions"
click node_perf_cat "https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Performance"
click node_rule_schema "https://github.com/tabulareditor/bestpracticerules/blob/master/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_standard_src,node_dax_cat,node_fmt_cat,node_meta_cat,node_layout_cat,node_naming_cat,node_perf_cat,node_rule_schema toneBlue
class node_build_combine,node_build_split toneAmber
class node_root_standard,node_root_standard_lax,node_root_contrib,node_root_powerbi toneMint
class node_tabular_editor,node_bpa_engine,node_dynamic_linq,node_model_objects toneRose
```

## Components

### Source rules

Per-rule JSON definitions maintained as the source of truth.

- [Standard rules](https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard): source ruleset · Main maintained source tree for individual rule definitions. · `src/standard`
- [DAX Expressions](https://github.com/tabulareditor/bestpracticerules/tree/HEAD/src/standard/DAX%20Expressions): category · Rules targeting DAX formula quality and authoring patterns. · `src/standard/DAX Expressions`
- [Formatting](https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Formatting): category · Rules for formatting and expression style consistency. · `src/standard/Formatting`
- [Metadata](https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Metadata): category · Rules focused on model metadata and semantic properties. · `src/standard/Metadata`
- [Model Layout](https://github.com/tabulareditor/bestpracticerules/tree/HEAD/src/standard/Model%20Layout): category · Rules for visibility, descriptions, and presentation of model objects. · `src/standard/Model Layout`
- [Naming Conventions](https://github.com/tabulareditor/bestpracticerules/tree/HEAD/src/standard/Naming%20Conventions): category · Rules enforcing consistent object and relationship naming. · `src/standard/Naming Conventions`
- [Performance](https://github.com/tabulareditor/bestpracticerules/tree/master/src/standard/Performance): category · Rules identifying modeling choices with performance impact. · `src/standard/Performance`
- [Rule schema](https://github.com/tabulareditor/bestpracticerules/blob/master/README.md): json schema · Shared rule shape: ID, Name, Category, Description, Severity, Scope, Expression, optional FixExpression and Remarks. · `README.md`

### Build & packaging

Scripts that split and combine rule fragments into distributable bundles.

- [Combine rules](https://github.com/tabulareditor/bestpracticerules/blob/master/build/combine-rules.ps1): powershell script · Build step that assembles per-rule JSON files into release bundles. · `build/combine-rules.ps1`
- [Split rules](https://github.com/tabulareditor/bestpracticerules/blob/master/build/split-rules.ps1): powershell script · Build step that decomposes combined rulesets into individual files. · `build/split-rules.ps1`

### Release bundles

Packaged JSON artifacts published for Tabular Editor users.

- [Standard pack](https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-standard.json): ruleset bundle · Primary curated baseline ruleset for release. · `BPARules-standard.json`
- [Standard lax](https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-standard-lax.json): ruleset bundle · Alternative standard pack with relaxed checks. · `BPARules-standard-lax.json`
- [Contrib pack](https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-contrib.json): ruleset bundle · Community-oriented packaged ruleset. · `BPARules-contrib.json`
- [PowerBI pack](https://github.com/tabulareditor/bestpracticerules/blob/master/BPARules-PowerBI.json): ruleset bundle · Packaged ruleset tailored to Power BI-oriented modeling. · `BPARules-PowerBI.json`

### Downstream consumer

External tool that loads and evaluates the packaged rule sets.

- **Tabular Editor**: desktop consumer · External modeling tool that loads the packaged BPA rule JSON.
- **BPA engine**: analyzer runtime · Best Practice Analyzer evaluates rules against tabular model objects.
- **Dynamic LINQ**: expression language · Execution language used in rule Expression fields.
- **Tabular model**: analysis target · Model metadata and DAX expressions inspected by the rules.

## Connections

- Standard rules → DAX Expressions: contains · Source tree is organized into analyzer categories.
- Standard rules → Formatting: contains · Source tree is organized into analyzer categories.
- Standard rules → Metadata: contains · Source tree is organized into analyzer categories.
- Standard rules → Model Layout: contains · Source tree is organized into analyzer categories.
- Standard rules → Naming Conventions: contains · Source tree is organized into analyzer categories.
- Standard rules → Performance: contains · Source tree is organized into analyzer categories.
- DAX Expressions → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Formatting → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Metadata → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Model Layout → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Naming Conventions → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Performance → Rule schema: uses · Each rule file follows the shared JSON rule contract.
- Split rules → Standard rules: extracts · Splits combined rules into per-rule source files.
- Combine rules → Standard pack: assembles · Combines source rules into the standard release bundle.
- Combine rules → Standard lax: assembles · Combines curated inputs into the relaxed release bundle.
- Combine rules → Contrib pack: assembles · Combines curated inputs into the contributor bundle.
- Combine rules → PowerBI pack: assembles · Combines curated inputs into the Power BI bundle.
- Standard pack → Tabular Editor: loaded by · Packaged bundle is consumed by the desktop tool.
- Standard lax → Tabular Editor: loaded by · Packaged bundle is consumed by the desktop tool.
- Contrib pack → Tabular Editor: loaded by · Packaged bundle is consumed by the desktop tool.
- PowerBI pack → Tabular Editor: loaded by · Packaged bundle is consumed by the desktop tool.
- Tabular Editor → BPA engine: hosts · The tool provides the BPA execution environment.
- BPA engine → Dynamic LINQ: evaluates · Rule expressions are executed as Dynamic LINQ.
- Dynamic LINQ → Tabular model: queries · Expressions inspect tabular model metadata and DAX objects.
- BPA engine → Tabular model: analyzes · Rules are applied to the model being authored.
