|
1 | 1 | (function() {
|
2 |
| - /^http:\/\/example.com/; // OK |
3 |
| - /^http:\/\/test.example.com/; // NOT OK |
4 |
| - /^http:\/\/test\\.example.com/; // OK |
5 |
| - /^http:\/\/test.example.net/; // NOT OK |
6 |
| - /^http:\/\/test.(example-a|example-b).com/; // NOT OK |
7 |
| - /^http:\/\/(.+).example.com\//; // NOT OK |
8 |
| - /^http:\/\/(\\.+)\\.example.com/; // OK |
9 |
| - /^http:\/\/(?:.+)\\.test\\.example.com\//; // NOT OK |
10 |
| - /^http:\/\/test.example.com\/(?:.*)/; // OK |
11 |
| - new RegExp("^http://test.example.com"); // NOT OK |
12 |
| - if (s.match("^http://test.example.com")) {} // NOT OK |
| 2 | + /^http:\/\/example.com/; |
| 3 | + /^http:\/\/test.example.com/; // $ Alert |
| 4 | + /^http:\/\/test\\.example.com/; |
| 5 | + /^http:\/\/test.example.net/; // $ Alert |
| 6 | + /^http:\/\/test.(example-a|example-b).com/; // $ Alert |
| 7 | + /^http:\/\/(.+).example.com\//; // $ Alert |
| 8 | + /^http:\/\/(\\.+)\\.example.com/; |
| 9 | + /^http:\/\/(?:.+)\\.test\\.example.com\//; // $ Alert |
| 10 | + /^http:\/\/test.example.com\/(?:.*)/; |
| 11 | + new RegExp("^http://test.example.com"); // $ Alert |
| 12 | + if (s.match("^http://test.example.com")) {} // $ Alert |
13 | 13 |
|
14 | 14 | function id(e) { return e; }
|
15 |
| - new RegExp(id(id(id("^http://test.example.com")))); // NOT OK |
| 15 | + new RegExp(id(id(id("^http://test.example.com")))); // $ Alert |
16 | 16 |
|
17 |
| - new RegExp(`test.example.com$`); // NOT OK |
| 17 | + new RegExp(`test.example.com$`); // $ Alert |
18 | 18 |
|
19 |
| - let hostname = '^test.example.com'; // NOT OK |
| 19 | + let hostname = '^test.example.com'; // $ Alert |
20 | 20 | new RegExp(`${hostname}$`);
|
21 | 21 |
|
22 |
| - let domain = { hostname: 'test.example.com$' }; // NOT OK |
| 22 | + let domain = { hostname: 'test.example.com$' }; // $ Alert |
23 | 23 | new RegExp(domain.hostname);
|
24 | 24 |
|
25 | 25 | function convert1(domain) {
|
26 | 26 | return new RegExp(domain.hostname);
|
27 | 27 | }
|
28 |
| - convert1({ hostname: 'test.example.com$' }); // NOT OK |
| 28 | + convert1({ hostname: 'test.example.com$' }); // $ Alert |
29 | 29 |
|
30 |
| - let domains = [ { hostname: 'test.example.com$' } ]; // NOT OK |
| 30 | + let domains = [ { hostname: 'test.example.com$' } ]; // $ Alert |
31 | 31 | function convert2(domain) {
|
32 | 32 | return new RegExp(domain.hostname);
|
33 | 33 | }
|
34 | 34 | domains.map(d => convert2(d));
|
35 | 35 |
|
36 |
| - /^(.+\.(?:example-a|example-b)\.com)\//; // NOT OK |
37 |
| - /^(https?:)?\/\/((service|www).)?example.com(?=$|\/)/; // NOT OK |
38 |
| - /^(http|https):\/\/www.example.com\/p\/f\//; // NOT OK |
39 |
| - /^(http:\/\/sub.example.com\/)/g; // NOT OK |
40 |
| - /^https?:\/\/api.example.com/; // NOT OK |
41 |
| - new RegExp('^http://localhost:8000|' + '^https?://.+\\.example\\.com/'); // NOT OK |
42 |
| - new RegExp('^http[s]?:\/\/?sub1\\.sub2\\.example\\.com\/f\/(.+)'); // NOT OK |
43 |
| - /^https:\/\/[a-z]*.example.com$/; // NOT OK |
44 |
| - RegExp('^protos?://(localhost|.+.example.net|.+.example-a.com|.+.example-b.com|.+.example.internal)'); // NOT OK |
| 36 | + /^(.+\.(?:example-a|example-b)\.com)\//; // $ Alert |
| 37 | + /^(https?:)?\/\/((service|www).)?example.com(?=$|\/)/; // $ Alert |
| 38 | + /^(http|https):\/\/www.example.com\/p\/f\//; // $ Alert |
| 39 | + /^(http:\/\/sub.example.com\/)/g; // $ Alert |
| 40 | + /^https?:\/\/api.example.com/; // $ Alert |
| 41 | + new RegExp('^http://localhost:8000|' + '^https?://.+\\.example\\.com/'); // $ Alert |
| 42 | + new RegExp('^http[s]?:\/\/?sub1\\.sub2\\.example\\.com\/f\/(.+)'); // $ Alert |
| 43 | + /^https:\/\/[a-z]*.example.com$/; // $ Alert |
| 44 | + RegExp('^protos?://(localhost|.+.example.net|.+.example-a.com|.+.example-b.com|.+.example.internal)'); // $ Alert |
45 | 45 |
|
46 | 46 | /^(example.dev|example.com)/; // OK
|
47 | 47 |
|
48 |
| - new RegExp('^http://localhost:8000|' + '^https?://.+.example\\.com/'); // NOT OK |
| 48 | + new RegExp('^http://localhost:8000|' + '^https?://.+.example\\.com/'); // $ Alert |
49 | 49 |
|
50 | 50 | var primary = 'example.com$';
|
51 |
| - new RegExp('test.' + primary); // NOT OK, but not detected |
| 51 | + new RegExp('test.' + primary); // $ MISSING: Alert |
52 | 52 |
|
53 |
| - new RegExp('test.' + 'example.com$'); // NOT OK |
| 53 | + new RegExp('test.' + 'example.com$'); // $ Alert |
54 | 54 |
|
55 |
| - new RegExp('^http://test\.example.com'); // NOT OK |
| 55 | + new RegExp('^http://test\.example.com'); // $ Alert |
56 | 56 |
|
57 | 57 | /^http:\/\/(..|...)\.example\.com\/index\.html/; // OK, wildcards are intentional
|
58 | 58 | /^http:\/\/.\.example\.com\/index\.html/; // OK, the wildcard is intentional
|
59 | 59 | /^(foo.example\.com|whatever)$/; // kinda OK - one disjunction doesn't even look like a hostname
|
60 | 60 |
|
61 |
| - if (s.matchAll("^http://test.example.com")) {} // NOT OK |
| 61 | + if (s.matchAll("^http://test.example.com")) {} // $ Alert |
62 | 62 | });
|
0 commit comments