Skip to content

Commit 2086389

Browse files
committed
Typo fixes in ruleset-style.md and update goals.
1 parent 00a095f commit 2086389

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

ruleset-style.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
# Ruleset style guide
22

33
Goal: Rules should be written in a way that is consistent, easy for humans to
4-
read and debug, and makes errors less likely.
4+
read and debug, and reduces the chance of errors, and makes testing easy.
55

66
To that end, here are some style guidelines for writing or modifying rulesets.
77
They are intended to help and simplify in places where choices are ambiguous,
88
but like all guidelines they can be broken if the circumstances require it.
99

10-
Avoid using the left-wildcard ("target host='*.example.com'") for unless you
10+
Avoid using the left-wildcard ("<target host='*.example.com'>") unless you
1111
really mean it. Many rules today specify a left-wildcard target, but the
1212
rewrite rules only rewrite an explicit list of hostnames.
1313

14-
Prefer listing explicit target hosts and a single rewrite from "^http:" to
14+
Instead, prefer listing explicit target hosts and a single rewrite from "^http:" to
1515
"^https:". This saves you time as a ruleset author because each explicit target
16-
host automatically creates a test URL, reducing the need to add your own test
17-
URLs. These also make it easier for someone reading the ruleset to figure out
16+
host automatically creates a an implicit test URL, reducing the need to add your
17+
own test URLs. These also make it easier for someone reading the ruleset to figure out
1818
which subdomains are covered.
1919

2020
If you know all subdomains of a given domain support HTTPS, go ahead and use a
2121
left-wildcard, along with a plain rewrite from "^http:" to "^https:". Make sure
2222
to add a bunch of test URLs for the more important subdomains. If you're not
23-
sure what subdomains might exist, check the 'subdomain tab on Wolfram Alpha:
23+
sure what subdomains might exist, check the 'subdomain' tab on Wolfram Alpha:
2424
http://www.wolframalpha.com/input/?i=_YOUR_DOMAIN_GOES_HERE_.
2525

2626
If there are a handful of tricky subdomains, but most subdomains can handle the
2727
plain rewrite from "^http:" to "^https:", specify the rules for the tricky
2828
subdomains first, and then then plain rule last. Earlier rules will take
2929
precedence, and processing stops at the first matching rule.
3030

31-
Avoid regexes with long strings of subdomains, e.g. <rule
32-
from="^http://(foo|bar|baz|bananas).example.com" />. These are hard to read and
31+
Avoid regexes with long strings of subdomains, e.g. &lt;rule
32+
from="^http://(foo|bar|baz|bananas).example.com" /&gt;. These are hard to read and
3333
maintain, and are usually better expressed with a longer list of target hosts,
3434
plus a plain rewrite from "^http:" to "^https:".
3535

36-
Prefer dashes over underscores in filenames.
36+
Prefer dashes over underscores in filenames. Dashes are easier to type.
3737

3838
When matching an arbitrary DNS label (a single component of a hostname), prefer
3939
`([\w-]+)` for a single label (i.e www), or `([\w-.]+)` for multiple labels
40-
(i.e. www.beta). Avoid the more visually complicated `([^/:@\.]+\.)?`, seen in
41-
some rules.
40+
(i.e. www.beta). Avoid more visually complicated options like `([^/:@\.]+\.)?`.
4241

4342
For `securecookie` tags, it's common to match any cookie name. For these, prefer
4443
`.+` over `.*`. They are functionally equivalent, but it's nice to be
@@ -82,6 +81,8 @@ test URLs:
8281
8382
<test url="http://html.spec.whatwg.org/" />
8483
<test url="http://fetch.spec.whatwg.org/" />
84+
<test url="http://xhr.spec.whatwg.org/" />
85+
<test url="http://dom.spec.whatwg.org/" />
8586
8687
<rule from="^http:"
8788
to="https:" />

0 commit comments

Comments
 (0)