spl:add-constraints

Introduction

spl:add-constraints compares what the features of a model import with the constraints the model declares, and offers to add the ones missing. Run it after changing features’ code, to keep the model in step without editing it by hand.

splent spl:add-constraints my_spl
  Found 1 missing constraint(s):

  ? UNDECLARED
    reports imports notes, no UVL constraint exists

    Suggested constraint: reports => notes

    Action (add, skip, invert) [add]: add
    Will add: reports => notes

  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---  ---

  Adding 1 constraint(s) to /workspace/splent_spl_my/my_spl.uvl:
    + reports => notes

  Write to UVL file? [Y/n]: y
  UVL updated: /workspace/splent_spl_my/my_spl.uvl

With nothing missing it prints All cross-feature imports have matching UVL constraints.


Choosing what to do with each one

Kind Means Default
UNDECLARED a imports b and no constraint relates them add
INVERTED The model says b => a, but the code has a import b skip

add queues the constraint. skip leaves it out. invert records an inversion, a dependency the code has the wrong way round, and the command lists it at the end as a refactoring to do in a.

The queued constraints are written only after you confirm once.


What it scans

Only the features the model declares and whose directory is at the workspace root, such as splent_feature_reports/. Features of other lines in the same workspace are ignored. In each one it reads the Python imports of other splent_io.splent_feature_* packages of the model.

The new constraints go after the last existing one, in a constraints section created if there is none. The file is backed up, written atomically and parsed again. If a constraint did not land or the model does not parse, the original is restored.

The edit goes to the working copy, never to the cache. A model that only exists in the cache is copied to a working copy first, as spl:add-feature does.


Requirements

  • Detached mode, with no product selected. A leading SPLENT_APP= runs one command detached and keeps your selection.

See also

  • spl:add-feature adds a feature with its constraints in one go.
  • spl:deps shows the dependencies the model declares.
  • product:validate checks a product’s imports against the model, in its phase 3.

Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es