html-proofer 3.18.5 → 3.18.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e90edda0dcb30f00baa440ec7b231bf73e086e0414fe9a1a56870940e2c15aeb
4
- data.tar.gz: 2505df1fb597aaadfa68bf0f7c8b3d9380e27a236c31582d4c91840bf5e65623
3
+ metadata.gz: e2d6deb85601ff3f5e5df02999f1b55f29231e5658f1d4fa9986c002b3cc0263
4
+ data.tar.gz: e20a007144a866b41b97eb36a964ca1372d693ade77acc69a9c9e706b353c8ef
5
5
  SHA512:
6
- metadata.gz: c5b864da4544723801ade7b906c387f893aed338ca36f9f3ae4a4660fa69f2f60883071cb2030cf526911abe954cf81932691a96c7c8f93e5e6970a18120449a
7
- data.tar.gz: b141806119a645c1b974028f4e4ec3ecf60d74d51d1f5575d8b2fab4a3c7e90ddd8a6f8511474bd64825d49f591630ed8e9be83c1d5676b22b0f73b42ce93e3e
6
+ metadata.gz: c51154450eb20c04c0b7038effb12ab8d258457ea5560421b5a2a0739342504afebb8fd092fe4378838a076636ff2665eb691f513b8b34b49af2e89ffba988c2
7
+ data.tar.gz: fcb7bf492588fabc991caf1f779fca14a7b553d3ce00dbf55ba24aebf3c39f7613af6a408d94c3a3faaeb21dceb8265ece91ca9bf4320aee7d4f3dca133ba4de
@@ -109,8 +109,13 @@ module HTMLProofer
109
109
  additions
110
110
  end
111
111
 
112
+ # TODO: Garbage performance--both the external and internal
113
+ # caches need access to this file. Write a proper versioned
114
+ # schema in the future
112
115
  def write
113
- File.write(cache_file, @cache_log.to_json)
116
+ file = {}
117
+ file = JSON.parse(File.read(cache_file)) if File.exist?(cache_file)
118
+ File.write(cache_file, file.merge(@cache_log).to_json)
114
119
  end
115
120
 
116
121
  def load?
@@ -59,11 +59,8 @@ class LinkCheck < ::HTMLProofer::Check
59
59
  add_to_external_urls(@link.href || @link.src)
60
60
  next
61
61
  elsif @link.internal?
62
- if @link.exists? || @link.hash
63
- add_to_internal_urls(@link.href, InternalLink.new(@link, @path, line, content))
64
- else
65
- add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content)
66
- end
62
+ add_to_internal_urls(@link.href, InternalLink.new(@link, @path, line, content))
63
+ add_issue("internally linking to #{@link.href}, which does not exist", line: line, content: content) if !@link.exists? && !@link.hash
67
64
  end
68
65
  end
69
66
 
@@ -24,7 +24,7 @@ module HTMLProofer
24
24
  raise e
25
25
  end
26
26
 
27
- @aria_hidden = defined?(@aria_hidden) && @aria_hidden == 'true' ? true : false
27
+ @aria_hidden = defined?(@aria_hidden) && @aria_hidden == 'true'
28
28
 
29
29
  @data_proofer_ignore = defined?(@data_proofer_ignore)
30
30
 
@@ -220,6 +220,8 @@ module HTMLProofer
220
220
  end
221
221
 
222
222
  def ignores_pattern_check(links)
223
+ return false unless links.is_a?(Array)
224
+
223
225
  links.each do |ignore|
224
226
  case ignore
225
227
  when String
@@ -22,7 +22,7 @@ module HTMLProofer
22
22
  allow_hash_href: true,
23
23
  check_external_hash: true,
24
24
  check_html: true,
25
- url_ignore: [/.*/], # Don't try to check if local files exist
25
+ url_ignore: [%r{^/}], # Don't try to check if local files exist
26
26
  validation: { report_eof_tags: true }
27
27
  }
28
28
  end
@@ -63,7 +63,9 @@ module HTMLProofer
63
63
  swap(url, @options[:url_swap])
64
64
  end
65
65
  end
66
- @external_urls = Hash[*@src.map { |s| [s, nil] }.flatten]
66
+ @external_urls = @src.each_with_object({}) do |url, hash|
67
+ hash[url] = nil
68
+ end
67
69
  validate_external_urls
68
70
  end
69
71
 
@@ -123,7 +125,7 @@ module HTMLProofer
123
125
  end
124
126
 
125
127
  external_urls = check.external_urls
126
- external_urls = Hash[check.external_urls.map { |url, file| [swap(url, @options[:url_swap]), file] }] if @options[:url_swap]
128
+ external_urls = check.external_urls.map { |url, file| [swap(url, @options[:url_swap]), file] }.to_h if @options[:url_swap]
127
129
  result[:external_urls].merge!(external_urls)
128
130
  result[:failures].concat(check.issues)
129
131
  end
@@ -85,7 +85,7 @@ module HTMLProofer
85
85
  # for HEAD. If we've decided to check for hashes, we must do a GET--HEAD is
86
86
  # not available as an option.
87
87
  def external_link_checker(external_urls)
88
- external_urls = Hash[external_urls.sort]
88
+ external_urls = external_urls.sort.to_h
89
89
 
90
90
  count = external_urls.length
91
91
  check_text = pluralize(count, 'external link', 'external links')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = '3.18.5'
4
+ VERSION = '3.18.6'
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.18.5
4
+ version: 3.18.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-02 00:00:00.000000000 Z
11
+ date: 2021-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable