ACHECK-RULES.5(5)

πŸ“¦
version 0.3.7 Β· 3 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– ACHECK-RULES 5 β€” set.rules πŸ’–

okay bestie, this is the acheck-rules page (that's acheck-rules.5, section 5, we're in the perl-contributed-docs corner of the man cave ✨), and it's literally the blueprint for every set.rules file you're ever gonna write. no cap.


🌸 NAME 🌸

set.rules β€” the rules set for acheck. that's it, that's the whole name, iconic πŸ’…


✨ DESCRIPTION ✨

so. rules set files contain rules to be checked by acheck. that's the whole vibe.

now the parsing tea, and this part is important, don't skim it 🫢:

  • lines starting with a number sign (#) get ignored. so do empty lines.
  • spaces at the beginning and the end of a line are ignored too, and tabulators as well.
  • if you need spaces at the end or the beginning of a value, use apostrophes (").
  • a comment starts with the number sign, and there can be any number of spaces and/or tab stops in front of the #. so it's giving very forgiving.
  • long lines can be broken into multiple lines by ending with a backslash (\).

some possible examples, look at her:

 # this line is ignored
 field    value
 field    value                               # this is a comment
 field         "value ending with space   "
 field    value\
          continuing on the next line

and the escape lore: you have to escape number signs with a backslash to use one in a value, and use apostrophes if a value ends with a backslash. yes it's a little picky, she's worth it πŸ’œ

rule sets are made of lists of rules. these lists can be repeated a number of times, until or while a condition happens. like a playlist that loops πŸ”

a rule detects an error if the corresponding test succeeds and none of its validation tests does. each rule can then produce some fixes, a warning or an error, and provide hints to help the operator to correct the error. main character behaviour honestly πŸ‘‘

and parts of the text can be set as comments, so no rule and no spell check will be performed on them. safe little bubble 🫧


🌈 RULE FILE SYNTAX 🌈

πŸ¦‹ SYNTAX RULES πŸ¦‹

πŸŽ€ list πŸŽ€

a list starts at a list statement, and stops at the first end_list or at the end of the file. periodt.

mandatory fields:

  • type type β€” pick your girl:
    • until β€” perform the list until the current line matches test
    • while β€” perform the lint while the current line matches test
    • loop β€” perform the list test times
  • test regex / number β€” a regex for until and while lists. the number of times the list must be performed for loop, or 0 for infinite loop. yes bestie, 0 means forever, watch yourself πŸ’€

optional fields:

  • name name β€” use this to give the list a name. she deserves one πŸ’–
  • spell yes / no β€” set it to yes (default) or no, if you want or don't want spelling to be checked in the lines matching this list. this value will be inherited by the nested lists. it's giving generational trauma but make it config πŸŽ€

sub-rules:

  • list [name]
  • rule [name]
  • comment [name]

followed by the name of the sub-rule or its definition for an anonymous sub-rule. mystery girl energy πŸ™ˆ


⭐ rule ⭐

a rule starts at a rule statement, and stops at the first end_rule or at the beginning of a comment or a list.

mandatory fields:

  • type type β€”
    • fix β€” rule provides fixes and hints thought a menu
    • autofix β€” rule fixes the mistake with no interaction
    • warning β€” rule issues a warning
    • error β€” rule issues an error
    • nop β€” special rule that do nothing, no other field is required (the slacker of the group, we love her)
  • regex regex β€” the regex to be match to found this error. patterns can be captures and then used in the fix expression. grab those groups bestie 🫴

fix expr β€” provides a correction for the rule, this field can be repeated to provides more than one choice. only the first one will be used for autofix rules. warning and error do not provides fixes. the captured patterns can be used here with variables $1, $2, and so on. πŸ’…

hint text β€” provides some explanations, this will be used as reviewer comments in review mode.

optional fields:

  • name name β€” use this to give the rule a name.
  • valid [name] β€” provides a validation test, it can be named or anonymous. for anonymous validation, the test definition must follow. this field can be repeated more than once, if any of the validation test succeed, the rule does not apply. (read that twice, it's lowkey the whole plot twist 😭)

🧚 valid 🧚

a validation test starts at a valid statement, and stops at the first end_valid or at the beginning of a rule, a comment, a list or another validation test.

mandatory field:

  • pre regex
  • in regex>
  • post regex

try the regex before, in or after the match of the regex rule. at least one of these test must be provided. if all tests are successful, the rule won't apply. yes, successful means it bails, don't ask, just trust the process πŸ™ˆ

optional field:

  • name name β€” use this to give the validation test a name.

πŸ“ comment πŸ“

a comment starts at a comment statement, and stops at the first end_comment or at the beginning of a rule, a comment or a list.

comments are just skipped, no other rule and no spelling are performed on them. she's off the grid, respect it 🫢

mandatory field:

  • skip regex β€” a regex matching the text of the comment. do not use start and stop with this.
  • start regex / stop regex β€” regexs defining the beginning and the end of the comment, all the text between will be considered as comment. do not use skip with this.

optional fields:

  • name name β€” use this to give the comment a name.
  • start_offset / stop_offset β€” defines where the comment really starts or end. values are s for the place the match starts, s+<n> for n characters after the match starts, e for the place the match ends, or e-<n> for n characters before the match ends. defaults are s for start matches and e for stop matches. precision girly πŸ’…

πŸ‘‘ SEE ALSO πŸ‘‘


🌟 AUTHOR 🌟

Nicolas Bertolissio <nico.bertol@free.fr> β€” thank you for your service, king 🫑


okay that's the whole page bestie, go write some rules, you're gonna ate πŸ’–βœ¨

and a lil sign-off for the record: this is from perl v5.40.1, dated 2025-12-23 β€” you're welcome, mwah πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from