word-operator
Ce que cela signifie#
A condition written with the words and, or, not in the action language (a body, a guard, a transition’s action, a ui expression, a test line that is the action language): it writes &&, ||, !. An error from edition 1.2, with its quick fix; before it, computed only when asked for: archec fix --only word-operator rewrites them, and keeps a word where the text would not read the same. archec fmt --edition 1.2 --write rewrites them and sets the edition. Not in strings, comments, Python, sentences or check conditions; a test line that is valid Python too (expect a and b) stays as written.
Exemple#
The action language writes a condition with &&, || and !; the words
and, or and not are still read, as other spellings, in every edition
before 1.2 — and nothing is said of them unless asked for, so an existing model stays clean.
archec fix --only word-operator --write rewrites them. It reads a fn's body
(fenced or not), on-enter, on-exit and a handler. It reads a transition's guard
and action when the simulator reads them as the action language. It reads a
derived value, a parameter's default, a ui's expressions and on bodies. And
it reads a test line that is the action language (a ```arche one, or one with a form only it has:
expect sent(GO) >= 1 and not c.busy). A test line valid in Python too
(expect c.a and not c.b) stays as written. Python and TypeScript bodies,
strings, comments, sentences, check conditions and formal properties are not
touched. Each edit is kept only where the text, read again, gives the same
tree. From edition 1.2 each word is an error with this fix, in the project's
own files (not a library's); archec fmt --edition 1.2 --write rewrites them
and sets the edition.
Comment le corriger#
Le message dit ce qui ne va pas et où, et souvent ce qui était voulu (Did you mean …?). Modifiez le modèle pour que ce que décrit cette page ne soit plus vrai, puis vérifiez à nouveau : archec check main.arche.
Une remarque de style : archec vet la signale, archec check non ; archec fmt --write corrige celles de mise en page.
archec check --beginner reformule les messages les plus courants en mots simples, avec les noms qui existent.
La correction automatique#
and, or, not of the action language written &&, \|\|, ! (not(x) → !(x), not x → !x): bodies, guards and actions the simulator reads as the action language, derived values, parameter defaults, ui expressions, test lines that are the action language. Each edit kept only where the text, read again, gives the same tree; else the finding says why. An error with this fix from edition 1.2; before it, computed only by archec fix --only word-operator.
Dans VS Code, l’ampoule sur la ligne (Quick Fix) l’applique. Dans le terminal, archec fix main.arche l’applique avec les autres corrections, puis vérifie à nouveau.
Dans le terminal#
archec explain word-operator affiche cette explication ; archec explain style liste les codes de son domaine.