Skip to content

docs: improve custom rule examples - #1767

Open
mvanhorn wants to merge 1 commit into
TNG:mainfrom
mvanhorn:fix/1438-custom-rule-examples
Open

mvanhorn wants to merge 1 commit into
TNG:mainfrom
mvanhorn:fix/1438-custom-rule-examples

Conversation

@mvanhorn

Copy link
Copy Markdown

Why

The custom-rules section of the user guide shows a single example, and that example only reports failures. Negating the rule therefore cannot point at calls that met the check, and the short way to turn a yes-or-no test into a condition is never shown.

The sample adds SimpleConditionEvent.violated only when the calling method lacks @secured, so a secured call records no event. Negation inverts events that were added and does not invent missing ones. ArchConditions.have and ArchConditions.be are also absent from that section.

What changed

The language API guide and the HTML index now show DescribedPredicate values passed to have and be, with grammatical descriptions, the resulting rule text, and both satisfied and violated messages. The hand-written condition records one SimpleConditionEvent per incoming call, using the @secured check as conditionSatisfied and a message for each outcome. The new prose covers per-call inversion, empty call lists, and why a description that already starts with "have" belongs on .that() rather than on ArchConditions.have.

Testing

The ArchUnit change touches documentation only, so there is no test to run.

Closes #1438

The language API guide and the HTML index now show DescribedPredicate
values passed to have and be, with grammatical descriptions, the
resulting rule text, and both satisfied and violated messages. The
hand-written condition records one SimpleConditionEvent per incoming
call, using the @secured check as conditionSatisfied and a message for
each outcome. The new prose covers per-call inversion, empty call lists,
and why a description that already starts with "have" belongs on .that()
rather than on ArchConditions.have.

Refs TNG#1438

Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add more/better examples for custom rules to the documentation

1 participant