Skip to main content

Module management_selection

Module management_selection 

Source
Expand description

The refusal of a direct command whose --policy selects a policy that is off. What: The --policy selection of a direct git cli-git check or fix: the names turned into shipped policies, and the refusal of a selection that names a policy which is off. Why: A mistyped policy ID must stop the command instead of selecting nothing. A policy that is off runs nothing, so a run limited to it would exit 0 with no output and read as “checked and clean”. A CI step or a person who selected the policy by name must learn that it did not run, and which cli-git.config.jsonc key turns it on. The commit, add and push lifecycles are not direct runs and keep skipping policies that are off.

In TS you’d write (pseudocode):

// const ids = names.map(shippedPolicy); const off = ids.filter(id => config.severity(id) === 'off'); if (off.length) throw new ConfigError(...);

Functions§

selected_policies
What: Turn the selected policy names into policy identities. Result<Vec<PolicyId>, ConfigError> is the identities, or the error naming the first name no shipped policy has. Why: --policy selects among shipped policies only; a mistyped ID must stop the command instead of selecting nothing.
selection_error
What: The refusal for a direct command, when any selected policy has severity off, or is on but does not run for this command; None when nothing is selected or every selected policy runs. &[PolicyId] is the --policy selection, &PolicyConfig the severities in effect, and trigger is DirectCheck or DirectFix. Why: One message names every such policy, in selection order, so a repeated --policy is answered once and a run never silently drops a selected policy.