Elfie

Documentation / Global properties

Global properties

global is the entity that stands for your whole program. What you add to it reaches every entity of every file.

At a glance

StatementEffect
global@targets.add(t);Build every entity for t, unless its file or the entity names its own targets.
global@acceptanceCriteria.add({ ... });Add a requirement the whole program must meet, reviewed once.
trait.apply(global);Apply a trait to every entity of every file.

Targets

def/targets.lfy
global@targets.add(mainApp);

An entity is built for its own @targets. If that list is empty, it uses its file's list, and if that's empty too, it uses global's. Most projects with one target add it to global and never think about it again.

Global criteria

def/rules.lfy
global
  @acceptanceCriteria
  .add({ behavior = `No output writes a secret to a log` })
  .add({ behavior = `Every user facing message is in plain English` });

A global criterion is a requirement of the whole program. Every unit's request includes it, and the verifier reviews it once, against the whole output, in a global review that runs after the batches are merged. A global criterion reviewed as violated plans the units whose output answers for it again.

Run the global review on its own with:

Terminal
elfie verify --global

Its result is written to elfie-requests/global.reviews.json.

Global traits

def/rules.lfy
trait logged: `Logs each call` {
  where (`It is called`) -> `One line naming {{@identifier}} is written to the log`;
}

logged.apply(global);

Every entity of every file now carries logged, and each gets the trait's criteria with {{@identifier}} rendered as its own name.

Global versus target guidance

Where you write itWho follows itReviewed
global@acceptanceCriteriaEvery unitYes, once, in the global review
A target const's @acceptanceCriteriaEvery unit of that targetNo. It is guidance.
A layer's criteriaEvery unit of targets using the layerNo. It is guidance.

Was this guide clear?

Share a suggestion