1- # Ruleset style guide
1+ # Ruleset Style Guide
22
3- Goal: Rules should be written in a way that is consistent, easy for humans to
4- read and debug, and reduces the chance of errors, and makes testing easy.
3+ Goal: rules should be written in a way that is consistent, easy for humans to
4+ read and debug, reduces the chance of errors, and makes testing easy.
55
66To that end, here are some style guidelines for writing or modifying rulesets.
77They are intended to help and simplify in places where choices are ambiguous,
@@ -26,7 +26,9 @@ http://www.wolframalpha.com/input/?i=_YOUR_DOMAIN_GOES_HERE_.
2626If there are a handful of tricky subdomains, but most subdomains can handle the
2727plain rewrite from "^http:" to "^https:", specify the rules for the tricky
2828subdomains first, and then then plain rule last. Earlier rules will take
29- precedence, and processing stops at the first matching rule.
29+ precedence, and processing stops at the first matching rule. There may be a tiny
30+ performance hit for processing exception cases earlier in the ruleset and the
31+ common case last, but in most cases the performance issue is trumped by readability.
3032
3133Avoid regexes with long strings of subdomains, e.g. < ; rule
3234from="^http://(foo|bar|baz|bananas).example.com" /> ; . These are hard to read and
0 commit comments