| Conditions | 1 |
| Total Lines | 71 |
| Code Lines | 71 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | package validate_test |
||
| 72 | func validURLs() []string { |
||
| 73 | return []string{ |
||
| 74 | "http://a.pl", |
||
| 75 | "http://www.example.com", |
||
| 76 | "HTTP://WWW.EXAMPLE.COM", |
||
| 77 | "http://www.example.com.", |
||
| 78 | "http://www.example.museum", |
||
| 79 | "https://example.com/", |
||
| 80 | "https://example.com:80/", |
||
| 81 | "http://examp_le.com", |
||
| 82 | "http://www.sub_domain.examp_le.com", |
||
| 83 | "http://www.example.coop/", |
||
| 84 | "http://www.test-example.com/", |
||
| 85 | "http://www.example.com/", |
||
| 86 | "http://example.fake/blog/", |
||
| 87 | "http://example.com/?", |
||
| 88 | "http://example.com/search?type=&q=url+validator", |
||
| 89 | "http://example.com/#", |
||
| 90 | "http://example.com/#?", |
||
| 91 | "http://www.example.com/doc/current/book/validation.html#supported-constraints", |
||
| 92 | "http://very.long.domain.name.com/", |
||
| 93 | "http://localhost/", |
||
| 94 | "http://myhost123/", |
||
| 95 | "http://127.0.0.1/", |
||
| 96 | "http://127.0.0.1:80/", |
||
| 97 | "http://[::1]/", |
||
| 98 | "http://[::1]:80/", |
||
| 99 | "http://[1:2:3::4:5:6:7]/", |
||
| 100 | "http://sãopaulo.com/", |
||
| 101 | "http://xn--sopaulo-xwa.com/", |
||
| 102 | "http://sãopaulo.com.br/", |
||
| 103 | "http://xn--sopaulo-xwa.com.br/", |
||
| 104 | "http://пример.испытание/", |
||
| 105 | "http://xn--e1afmkfd.xn--80akhbyknj4f/", |
||
| 106 | "http://مثال.إختبار/", |
||
| 107 | "http://xn--mgbh0fb.xn--kgbechtv/", |
||
| 108 | "http://例子.测试/", |
||
| 109 | "http://xn--fsqu00a.xn--0zwm56d/", |
||
| 110 | "http://例子.測試/", |
||
| 111 | "http://xn--fsqu00a.xn--g6w251d/", |
||
| 112 | "http://例え.テスト/", |
||
| 113 | "http://xn--r8jz45g.xn--zckzah/", |
||
| 114 | "http://مثال.آزمایشی/", |
||
| 115 | "http://xn--mgbh0fb.xn--hgbk6aj7f53bba/", |
||
| 116 | "http://실례.테스트/", |
||
| 117 | "http://xn--9n2bp8q.xn--9t4b11yi5a/", |
||
| 118 | "http://العربية.idn.icann.org/", |
||
| 119 | "http://xn--ogb.idn.icann.org/", |
||
| 120 | "http://xn--e1afmkfd.xn--80akhbyknj4f.xn--e1afmkfd/", |
||
| 121 | "http://xn--espaa-rta.xn--ca-ol-fsay5a/", |
||
| 122 | "http://xn--d1abbgf6aiiy.xn--p1ai/", |
||
| 123 | "http://☎.com/", |
||
| 124 | "http://username:[email protected]", |
||
| 125 | "http://user.name:[email protected]", |
||
| 126 | "http://user_name:[email protected]", |
||
| 127 | "http://username:[email protected]", |
||
| 128 | "http://user.name:[email protected]", |
||
| 129 | "http://[email protected]", |
||
| 130 | "http://[email protected]", |
||
| 131 | "http://u%24er:[email protected]", |
||
| 132 | "http://user:pa%24%[email protected]", |
||
| 133 | "http://example.com?", |
||
| 134 | "http://example.com?query=1", |
||
| 135 | "http://example.com/?query=1", |
||
| 136 | "http://example.com/?querie%24=1", |
||
| 137 | "http://example.com/path%24/?query=1", |
||
| 138 | "http://example.com#", |
||
| 139 | "http://example.com#fragment", |
||
| 140 | "http://example.com/#fragment", |
||
| 141 | "http://example.com/#one_more%20test", |
||
| 142 | "http://example.com/exploit.html?hello[0]=test", |
||
| 143 | } |
||
| 209 |