html-proofer 3.17.3 → 3.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78c779b0dfc11fd1d80baaf4133ee26b695e13fcb20ed3852cb99a65caef7e24
4
- data.tar.gz: 71e4f5e229d8754bc1ad01d4dc28d76ae43f0c5c2d0e3ff2871c32ae4ce89c42
3
+ metadata.gz: a7d5f07fea9b72a1731abbdd7066c4d7e5807daf4d622f45b051a240216dac41
4
+ data.tar.gz: 6cbe2fa0408ba39f759e6fb3a93902d73009ccdab1b083a41a29660855539564
5
5
  SHA512:
6
- metadata.gz: aa82fcbba561ef4107dce9188d2c451ee8c40afbf5ff67dbd4f98729f91fec40ce3b58f2e13fd04a9e2f91258757f283240680cbf7b609e2c3b7000168b2fff6
7
- data.tar.gz: 848b2d731f440c3128c77e4cdddcb54ffc18cf1fdd423afc63b9300ccf074ad457b0064b70aab59d950ea242ba3e01b2ff33f8e02491859c24f23d5895f6f705
6
+ metadata.gz: de2d7e2dff071f8b36e92e7bbfd913308aa8c7b1e4f2d58ee798d5598b64c9167817d55e3091091752858976d1fad5f0df9d62858596add03ff4233da041f476
7
+ data.tar.gz: 6da898dd1b1ac623df5ef637049bea96872860a51fb486e5637cc59db19e9c609826d0846b89af67eb447fa20d9ad2584e4a5d8671cc0e3c4ce9ce327b55a785
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Naming/FileName
1
2
  # frozen_string_literal: true
2
3
 
3
4
  def require_all(path)
@@ -52,3 +53,4 @@ module HTMLProofer
52
53
  HTMLProofer::Runner.new(links, options)
53
54
  end
54
55
  end
56
+ # rubocop:enable Naming/FileName
@@ -45,7 +45,7 @@ class LinkCheck < ::HTMLProofer::Check
45
45
  # intentionally here because we still want valid? & missing_href? to execute
46
46
  next if @link.non_http_remote?
47
47
 
48
- if !@link.internal? && @link.remote?
48
+ if !@link.href&.start_with?('#') && !@link.internal? && @link.remote?
49
49
  check_sri(line, content) if @link.check_sri? && node.name == 'link'
50
50
  # we need to skip these for now; although the domain main be valid,
51
51
  # curl/Typheous inaccurately return 404s for some links. cc https://git.io/vyCFx
@@ -54,7 +54,7 @@ class LinkCheck < ::HTMLProofer::Check
54
54
  add_to_external_urls(@link.href || @link.src)
55
55
  next
56
56
  elsif @link.internal?
57
- if @link.exists?
57
+ if @link.exists? || @link.hash
58
58
  add_to_internal_urls(@link.href, InternalLink.new(@link, @path, line, content))
59
59
  else
60
60
  add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content)
@@ -72,10 +72,10 @@ class LinkCheck < ::HTMLProofer::Check
72
72
  return false
73
73
  end
74
74
 
75
- # verify the target hash
76
- return handle_hash(link, path, line, content) if link.hash
75
+ return true unless link.hash
77
76
 
78
- true
77
+ # verify the target hash
78
+ handle_hash(link, path, line, content)
79
79
  end
80
80
 
81
81
  def check_schemes(link, line, content)
@@ -147,6 +147,9 @@ module HTMLProofer
147
147
  urls_to_check = load_internal_cache
148
148
 
149
149
  urls_to_check.each_pair do |url, internal_urls|
150
+ # pulled from cache
151
+ internal_urls = @internal_urls[url] unless internal_urls.first.is_a?(LinkCheck::InternalLink)
152
+
150
153
  result = @internal_link_checks.check_internal_link(internal_urls.first.link, internal_urls.first.path, internal_urls.first.line, internal_urls.first.content)
151
154
  code = result ? 200 : 404
152
155
  @cache.add(url, @internal_urls_to_paths[url].sort, code, '') # TODO: blank msg for now
@@ -154,11 +157,12 @@ module HTMLProofer
154
157
  @cache.write
155
158
  else
156
159
  @internal_urls.values.flatten.each do |internal_url|
157
- @internal_link_checks.check_internal_link(internal_url.link, internal_url.path, internal_url.line, internal_url.content)
160
+ result = @internal_link_checks.check_internal_link(internal_url.link, internal_url.path, internal_url.line, internal_url.content)
161
+ next if result
162
+
163
+ @failures.concat(@internal_link_checks.issues) unless @internal_link_checks.issues.length.zero?
158
164
  end
159
165
  end
160
-
161
- @failures.concat(@internal_link_checks.issues) unless @internal_urls.length.zero?
162
166
  end
163
167
 
164
168
  def files
@@ -211,7 +215,8 @@ module HTMLProofer
211
215
  sorted_failures.sort_and_report
212
216
  count = @failures.length
213
217
  failure_text = pluralize(count, 'failure', 'failures')
214
- raise @logger.colorize :fatal, "HTML-Proofer found #{failure_text}!"
218
+ @logger.log :fatal, "\nHTML-Proofer found #{failure_text}!"
219
+ exit 1
215
220
  end
216
221
 
217
222
  # Set before_request callback.
@@ -120,7 +120,7 @@ module HTMLProofer
120
120
  def clean_url(href)
121
121
  # catch any obvious issues, like strings in port numbers
122
122
  parsed = Addressable::URI.parse(href)
123
- if href =~ /^([!#{$&}-;=?-\[\]_a-z~]|%[0-9a-fA-F]{2})+$/
123
+ if href =~ /^([!#{Regexp.last_match(0)}-;=?-\[\]_a-z~]|%[0-9a-fA-F]{2})+$/
124
124
  href
125
125
  else
126
126
  parsed.normalize
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = '3.17.3'
4
+ VERSION = '3.18.3'
5
5
  end
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: 3.17.3
4
+ version: 3.18.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-28 00:00:00.000000000 Z
11
+ date: 2020-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -285,16 +285,19 @@ require_paths:
285
285
  - lib
286
286
  required_ruby_version: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - "~>"
288
+ - - ">="
289
+ - !ruby/object:Gem::Version
290
+ version: 2.4.10
291
+ - - "<"
289
292
  - !ruby/object:Gem::Version
290
- version: '2.4'
293
+ version: '4.0'
291
294
  required_rubygems_version: !ruby/object:Gem::Requirement
292
295
  requirements:
293
296
  - - ">="
294
297
  - !ruby/object:Gem::Version
295
298
  version: '0'
296
299
  requirements: []
297
- rubygems_version: 3.1.2
300
+ rubygems_version: 3.1.4
298
301
  signing_key:
299
302
  specification_version: 4
300
303
  summary: A set of tests to validate your HTML output. These tests check if your image