html-proofer 2.4.2 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +56 -46
- data/bin/htmlproof +4 -2
- data/lib/html/proofer.rb +20 -13
- data/lib/html/proofer/cache.rb +16 -0
- data/lib/html/proofer/check_runner.rb +39 -6
- data/lib/html/proofer/checkable.rb +5 -5
- data/lib/html/proofer/checks/favicon.rb +8 -8
- data/lib/html/proofer/checks/html.rb +6 -4
- data/lib/html/proofer/checks/images.rb +9 -12
- data/lib/html/proofer/checks/links.rb +47 -32
- data/lib/html/proofer/checks/scripts.rb +6 -5
- data/lib/html/proofer/log.rb +6 -2
- data/lib/html/proofer/url_validator.rb +6 -6
- data/lib/html/proofer/utils.rb +17 -15
- data/lib/html/proofer/version.rb +1 -1
- data/spec/html/proofer/fixtures/links/check_just_once.html +8 -0
- data/spec/html/proofer/fixtures/vcr_cassettes/links/check_just_once_html.yml +87 -0
- data/spec/html/proofer/fixtures/vcr_cassettes/sorting/status_verbosity_info_typhoeus_followlocation_false_error_sort_status_.yml +244 -0
- data/spec/html/proofer/links_spec.rb +6 -0
- data/spec/html/proofer/utils_spec.rb +3 -3
- data/spec/html/proofer_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -0
- metadata +9 -2
@@ -0,0 +1,244 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: head
|
5
|
+
uri: http://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Mozilla/5.0 (compatible; HTML Proofer/2.4.2; +https://github.com/gjtorikian/html-proofer)
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 301
|
15
|
+
message: TLS Redirect
|
16
|
+
headers:
|
17
|
+
Server:
|
18
|
+
- Varnish
|
19
|
+
Location:
|
20
|
+
- https://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
21
|
+
Content-Length:
|
22
|
+
- '0'
|
23
|
+
Accept-Ranges:
|
24
|
+
- bytes
|
25
|
+
Date:
|
26
|
+
- Tue, 08 Sep 2015 01:24:41 GMT
|
27
|
+
X-Varnish:
|
28
|
+
- '834465226'
|
29
|
+
Age:
|
30
|
+
- '0'
|
31
|
+
Via:
|
32
|
+
- 1.1 varnish
|
33
|
+
Connection:
|
34
|
+
- close
|
35
|
+
X-Cache:
|
36
|
+
- cp1074 frontend miss (0)
|
37
|
+
Access-Control-Allow-Origin:
|
38
|
+
- "*"
|
39
|
+
Access-Control-Expose-Headers:
|
40
|
+
- Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache, X-Varnish
|
41
|
+
Timing-Allow-Origin:
|
42
|
+
- "*"
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: ''
|
46
|
+
http_version: '1.1'
|
47
|
+
adapter_metadata:
|
48
|
+
effective_url: http://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
49
|
+
recorded_at: Tue, 08 Sep 2015 01:24:42 GMT
|
50
|
+
- request:
|
51
|
+
method: head
|
52
|
+
uri: http://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
53
|
+
body:
|
54
|
+
encoding: US-ASCII
|
55
|
+
string: ''
|
56
|
+
headers:
|
57
|
+
User-Agent:
|
58
|
+
- Mozilla/5.0 (compatible; HTML Proofer/2.4.2; +https://github.com/gjtorikian/html-proofer)
|
59
|
+
response:
|
60
|
+
status:
|
61
|
+
code: 301
|
62
|
+
message: TLS Redirect
|
63
|
+
headers:
|
64
|
+
Server:
|
65
|
+
- Varnish
|
66
|
+
Location:
|
67
|
+
- https://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
68
|
+
Content-Length:
|
69
|
+
- '0'
|
70
|
+
Accept-Ranges:
|
71
|
+
- bytes
|
72
|
+
Date:
|
73
|
+
- Tue, 08 Sep 2015 01:24:42 GMT
|
74
|
+
X-Varnish:
|
75
|
+
- '2973907557'
|
76
|
+
Age:
|
77
|
+
- '0'
|
78
|
+
Via:
|
79
|
+
- 1.1 varnish
|
80
|
+
Connection:
|
81
|
+
- close
|
82
|
+
X-Cache:
|
83
|
+
- cp1071 frontend miss (0)
|
84
|
+
Access-Control-Allow-Origin:
|
85
|
+
- "*"
|
86
|
+
Access-Control-Expose-Headers:
|
87
|
+
- Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache, X-Varnish
|
88
|
+
Timing-Allow-Origin:
|
89
|
+
- "*"
|
90
|
+
body:
|
91
|
+
encoding: UTF-8
|
92
|
+
string: ''
|
93
|
+
http_version: '1.1'
|
94
|
+
adapter_metadata:
|
95
|
+
effective_url: http://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
96
|
+
recorded_at: Tue, 08 Sep 2015 01:24:42 GMT
|
97
|
+
- request:
|
98
|
+
method: get
|
99
|
+
uri: http://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
100
|
+
body:
|
101
|
+
encoding: US-ASCII
|
102
|
+
string: ''
|
103
|
+
headers:
|
104
|
+
User-Agent:
|
105
|
+
- Mozilla/5.0 (compatible; HTML Proofer/2.4.2; +https://github.com/gjtorikian/html-proofer)
|
106
|
+
response:
|
107
|
+
status:
|
108
|
+
code: 301
|
109
|
+
message: TLS Redirect
|
110
|
+
headers:
|
111
|
+
Server:
|
112
|
+
- Varnish
|
113
|
+
Location:
|
114
|
+
- https://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
115
|
+
Content-Length:
|
116
|
+
- '0'
|
117
|
+
Accept-Ranges:
|
118
|
+
- bytes
|
119
|
+
Date:
|
120
|
+
- Tue, 08 Sep 2015 01:24:42 GMT
|
121
|
+
X-Varnish:
|
122
|
+
- '800279090'
|
123
|
+
Age:
|
124
|
+
- '0'
|
125
|
+
Via:
|
126
|
+
- 1.1 varnish
|
127
|
+
Connection:
|
128
|
+
- close
|
129
|
+
X-Cache:
|
130
|
+
- cp1072 frontend miss (0)
|
131
|
+
Access-Control-Allow-Origin:
|
132
|
+
- "*"
|
133
|
+
Access-Control-Expose-Headers:
|
134
|
+
- Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache, X-Varnish
|
135
|
+
Timing-Allow-Origin:
|
136
|
+
- "*"
|
137
|
+
body:
|
138
|
+
encoding: UTF-8
|
139
|
+
string: ''
|
140
|
+
http_version: '1.1'
|
141
|
+
adapter_metadata:
|
142
|
+
effective_url: http://upload.wikimedia.org/wikipedia/en/thumb/fooooof.png
|
143
|
+
recorded_at: Tue, 08 Sep 2015 01:24:42 GMT
|
144
|
+
- request:
|
145
|
+
method: get
|
146
|
+
uri: http://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
147
|
+
body:
|
148
|
+
encoding: US-ASCII
|
149
|
+
string: ''
|
150
|
+
headers:
|
151
|
+
User-Agent:
|
152
|
+
- Mozilla/5.0 (compatible; HTML Proofer/2.4.2; +https://github.com/gjtorikian/html-proofer)
|
153
|
+
response:
|
154
|
+
status:
|
155
|
+
code: 301
|
156
|
+
message: TLS Redirect
|
157
|
+
headers:
|
158
|
+
Server:
|
159
|
+
- Varnish
|
160
|
+
Location:
|
161
|
+
- https://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
162
|
+
Content-Length:
|
163
|
+
- '0'
|
164
|
+
Accept-Ranges:
|
165
|
+
- bytes
|
166
|
+
Date:
|
167
|
+
- Tue, 08 Sep 2015 01:24:42 GMT
|
168
|
+
X-Varnish:
|
169
|
+
- '612995440'
|
170
|
+
Age:
|
171
|
+
- '0'
|
172
|
+
Via:
|
173
|
+
- 1.1 varnish
|
174
|
+
Connection:
|
175
|
+
- close
|
176
|
+
X-Cache:
|
177
|
+
- cp1063 frontend miss (0)
|
178
|
+
Access-Control-Allow-Origin:
|
179
|
+
- "*"
|
180
|
+
Access-Control-Expose-Headers:
|
181
|
+
- Age, Date, Content-Length, Content-Range, X-Content-Duration, X-Cache, X-Varnish
|
182
|
+
Timing-Allow-Origin:
|
183
|
+
- "*"
|
184
|
+
body:
|
185
|
+
encoding: UTF-8
|
186
|
+
string: ''
|
187
|
+
http_version: '1.1'
|
188
|
+
adapter_metadata:
|
189
|
+
effective_url: http://upload.wikimedia.org/wikipedia/en/thumb/not_here.png
|
190
|
+
recorded_at: Tue, 08 Sep 2015 01:24:42 GMT
|
191
|
+
- request:
|
192
|
+
method: head
|
193
|
+
uri: https://help.github.com/changing-author-info/
|
194
|
+
body:
|
195
|
+
encoding: US-ASCII
|
196
|
+
string: ''
|
197
|
+
headers:
|
198
|
+
User-Agent:
|
199
|
+
- Mozilla/5.0 (compatible; HTML Proofer/2.4.2; +https://github.com/gjtorikian/html-proofer)
|
200
|
+
response:
|
201
|
+
status:
|
202
|
+
code: 200
|
203
|
+
message: OK
|
204
|
+
headers:
|
205
|
+
Server:
|
206
|
+
- GitHub.com
|
207
|
+
Content-Type:
|
208
|
+
- text/html; charset=utf-8
|
209
|
+
Last-Modified:
|
210
|
+
- Fri, 04 Sep 2015 18:26:39 GMT
|
211
|
+
Access-Control-Allow-Origin:
|
212
|
+
- "*"
|
213
|
+
Expires:
|
214
|
+
- Tue, 08 Sep 2015 01:34:42 GMT
|
215
|
+
Cache-Control:
|
216
|
+
- max-age=600
|
217
|
+
Content-Length:
|
218
|
+
- '458'
|
219
|
+
Accept-Ranges:
|
220
|
+
- bytes
|
221
|
+
Date:
|
222
|
+
- Tue, 08 Sep 2015 01:24:42 GMT
|
223
|
+
Via:
|
224
|
+
- 1.1 varnish
|
225
|
+
Age:
|
226
|
+
- '0'
|
227
|
+
Connection:
|
228
|
+
- keep-alive
|
229
|
+
X-Served-By:
|
230
|
+
- cache-sjc3125-SJC
|
231
|
+
X-Cache:
|
232
|
+
- MISS
|
233
|
+
X-Cache-Hits:
|
234
|
+
- '0'
|
235
|
+
Vary:
|
236
|
+
- Accept-Encoding
|
237
|
+
body:
|
238
|
+
encoding: UTF-8
|
239
|
+
string: ''
|
240
|
+
http_version: '1.1'
|
241
|
+
adapter_metadata:
|
242
|
+
effective_url: https://help.github.com/changing-author-info/
|
243
|
+
recorded_at: Tue, 08 Sep 2015 01:24:42 GMT
|
244
|
+
recorded_with: VCR 2.9.3
|
@@ -367,4 +367,10 @@ describe 'Links test' do
|
|
367
367
|
proofer = run_proofer(fixture)
|
368
368
|
expect(proofer.failed_tests).to eq []
|
369
369
|
end
|
370
|
+
|
371
|
+
it 'does not check links with parameters multiple times' do
|
372
|
+
fixture = "#{FIXTURES_DIR}/links/check_just_once.html"
|
373
|
+
proofer = run_proofer(fixture)
|
374
|
+
expect(proofer.external_urls.length).to eq 2
|
375
|
+
end
|
370
376
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe HTML::Utils do
|
3
|
+
describe HTML::Proofer::Utils do
|
4
4
|
describe '::create_nokogiri' do
|
5
5
|
it 'passes for a string' do
|
6
|
-
noko = HTML::Utils::create_nokogiri '<html lang="jp">'
|
6
|
+
noko = HTML::Proofer::Utils::create_nokogiri '<html lang="jp">'
|
7
7
|
expect(noko.css('html').first['lang']).to eq 'jp'
|
8
8
|
end
|
9
9
|
it 'passes for a file' do
|
10
|
-
noko = HTML::Utils::create_nokogiri "#{FIXTURES_DIR}/utils/lang-jp.html"
|
10
|
+
noko = HTML::Proofer::Utils::create_nokogiri "#{FIXTURES_DIR}/utils/lang-jp.html"
|
11
11
|
expect(noko.css('html').first['lang']).to eq 'jp'
|
12
12
|
end
|
13
13
|
end
|
data/spec/html/proofer_spec.rb
CHANGED
@@ -36,7 +36,7 @@ describe HTML::Proofer do
|
|
36
36
|
|
37
37
|
describe 'sorting' do
|
38
38
|
it 'understands sorting by path' do
|
39
|
-
output = send_proofer_output("#{FIXTURES_DIR}/sorting/path")
|
39
|
+
output = send_proofer_output("#{FIXTURES_DIR}/sorting/path", :verbosity => :info)
|
40
40
|
|
41
41
|
expect(output.strip).to eq('''
|
42
42
|
- spec/html/proofer/fixtures/sorting/path/multiple_issues.html
|
@@ -49,7 +49,7 @@ describe HTML::Proofer do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'understands sorting by issue' do
|
52
|
-
output = send_proofer_output("#{FIXTURES_DIR}/sorting/issue", :error_sort => :desc)
|
52
|
+
output = send_proofer_output("#{FIXTURES_DIR}/sorting/issue", :verbosity => :info, :error_sort => :desc)
|
53
53
|
expect(output.strip).to eq('''
|
54
54
|
- image ./gpl.png does not have an alt attribute
|
55
55
|
* spec/html/proofer/fixtures/sorting/issue/broken_image_one.html (line 1)
|
@@ -64,7 +64,7 @@ describe HTML::Proofer do
|
|
64
64
|
|
65
65
|
|
66
66
|
it 'understands sorting by status' do
|
67
|
-
output = send_proofer_output("#{FIXTURES_DIR}/sorting/status", :typhoeus => { :followlocation => false }, :error_sort => :status)
|
67
|
+
output = send_proofer_output("#{FIXTURES_DIR}/sorting/status", :verbosity => :info, :typhoeus => { :followlocation => false }, :error_sort => :status)
|
68
68
|
expect(output.gsub(/\s*$/, '')).to eq('''
|
69
69
|
- -1
|
70
70
|
* spec/html/proofer/fixtures/sorting/status/broken_link.html: internally linking to nowhere.fooof, which does not exist (line 3)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html-proofer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen Torikian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mercenary
|
@@ -195,6 +195,7 @@ files:
|
|
195
195
|
- bin/htmlproof
|
196
196
|
- html-proofer.gemspec
|
197
197
|
- lib/html/proofer.rb
|
198
|
+
- lib/html/proofer/cache.rb
|
198
199
|
- lib/html/proofer/check_runner.rb
|
199
200
|
- lib/html/proofer/check_runner/issue.rb
|
200
201
|
- lib/html/proofer/checkable.rb
|
@@ -263,6 +264,7 @@ files:
|
|
263
264
|
- spec/html/proofer/fixtures/links/brokenUnixLinks.html
|
264
265
|
- spec/html/proofer/fixtures/links/broken_hash_with_query.html
|
265
266
|
- spec/html/proofer/fixtures/links/checkSSLLinks.html
|
267
|
+
- spec/html/proofer/fixtures/links/check_just_once.html
|
266
268
|
- spec/html/proofer/fixtures/links/ensure_typhoeus_options.html
|
267
269
|
- spec/html/proofer/fixtures/links/erstiebegr%C3%BC%C3%9Fung.html
|
268
270
|
- spec/html/proofer/fixtures/links/erstiebegrüßung.html
|
@@ -347,6 +349,7 @@ files:
|
|
347
349
|
- spec/html/proofer/fixtures/vcr_cassettes/links/brokenLinkExternal_html.yml
|
348
350
|
- spec/html/proofer/fixtures/vcr_cassettes/links/brokenUnixLinks_html.yml
|
349
351
|
- spec/html/proofer/fixtures/vcr_cassettes/links/checkSSLLinks_html.yml
|
352
|
+
- spec/html/proofer/fixtures/vcr_cassettes/links/check_just_once_html.yml
|
350
353
|
- spec/html/proofer/fixtures/vcr_cassettes/links/ensure_typhoeus_options_html_typhoeus_ssl_verifypeer_false_.yml
|
351
354
|
- spec/html/proofer/fixtures/vcr_cassettes/links/escape_pipes_html.yml
|
352
355
|
- spec/html/proofer/fixtures/vcr_cassettes/links/file_foo_ext_foo_.yml
|
@@ -363,6 +366,7 @@ files:
|
|
363
366
|
- spec/html/proofer/fixtures/vcr_cassettes/links/utf8Link_html.yml
|
364
367
|
- spec/html/proofer/fixtures/vcr_cassettes/scripts/script_broken_external_html.yml
|
365
368
|
- spec/html/proofer/fixtures/vcr_cassettes/sorting/status_typhoeus_followlocation_false_error_sort_status_.yml
|
369
|
+
- spec/html/proofer/fixtures/vcr_cassettes/sorting/status_verbosity_info_typhoeus_followlocation_false_error_sort_status_.yml
|
366
370
|
- spec/html/proofer/fixtures/vcr_cassettes/www_garbalarba_com_href_swap_/garbalarba/_github_.yml
|
367
371
|
- spec/html/proofer/fixtures/vcr_cassettes/www_github_com_foofoofoo_biz.yml
|
368
372
|
- spec/html/proofer/html_spec.rb
|
@@ -453,6 +457,7 @@ test_files:
|
|
453
457
|
- spec/html/proofer/fixtures/links/brokenUnixLinks.html
|
454
458
|
- spec/html/proofer/fixtures/links/broken_hash_with_query.html
|
455
459
|
- spec/html/proofer/fixtures/links/checkSSLLinks.html
|
460
|
+
- spec/html/proofer/fixtures/links/check_just_once.html
|
456
461
|
- spec/html/proofer/fixtures/links/ensure_typhoeus_options.html
|
457
462
|
- spec/html/proofer/fixtures/links/erstiebegr%C3%BC%C3%9Fung.html
|
458
463
|
- spec/html/proofer/fixtures/links/erstiebegrüßung.html
|
@@ -537,6 +542,7 @@ test_files:
|
|
537
542
|
- spec/html/proofer/fixtures/vcr_cassettes/links/brokenLinkExternal_html.yml
|
538
543
|
- spec/html/proofer/fixtures/vcr_cassettes/links/brokenUnixLinks_html.yml
|
539
544
|
- spec/html/proofer/fixtures/vcr_cassettes/links/checkSSLLinks_html.yml
|
545
|
+
- spec/html/proofer/fixtures/vcr_cassettes/links/check_just_once_html.yml
|
540
546
|
- spec/html/proofer/fixtures/vcr_cassettes/links/ensure_typhoeus_options_html_typhoeus_ssl_verifypeer_false_.yml
|
541
547
|
- spec/html/proofer/fixtures/vcr_cassettes/links/escape_pipes_html.yml
|
542
548
|
- spec/html/proofer/fixtures/vcr_cassettes/links/file_foo_ext_foo_.yml
|
@@ -553,6 +559,7 @@ test_files:
|
|
553
559
|
- spec/html/proofer/fixtures/vcr_cassettes/links/utf8Link_html.yml
|
554
560
|
- spec/html/proofer/fixtures/vcr_cassettes/scripts/script_broken_external_html.yml
|
555
561
|
- spec/html/proofer/fixtures/vcr_cassettes/sorting/status_typhoeus_followlocation_false_error_sort_status_.yml
|
562
|
+
- spec/html/proofer/fixtures/vcr_cassettes/sorting/status_verbosity_info_typhoeus_followlocation_false_error_sort_status_.yml
|
556
563
|
- spec/html/proofer/fixtures/vcr_cassettes/www_garbalarba_com_href_swap_/garbalarba/_github_.yml
|
557
564
|
- spec/html/proofer/fixtures/vcr_cassettes/www_github_com_foofoofoo_biz.yml
|
558
565
|
- spec/html/proofer/html_spec.rb
|