File tree Expand file tree Collapse file tree 6 files changed +8
-10
lines changed Expand file tree Collapse file tree 6 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Gem::Specification.new do |gem|
26
26
gem . add_dependency 'yell' , '~> 2.0'
27
27
gem . add_dependency 'parallel' , '~> 1.3'
28
28
gem . add_dependency 'addressable' , '~> 2.3'
29
- gem . add_dependency 'activesupport ' , '>= 4.2' , '< 6.0 '
29
+ gem . add_dependency 'timerizer ' , '~> 0.3 '
30
30
31
31
gem . add_development_dependency 'redcarpet'
32
32
gem . add_development_dependency 'rubocop'
Original file line number Diff line number Diff line change 3
3
require_relative 'utils'
4
4
5
5
require 'json'
6
- require 'active_support/core_ext/string'
7
- require 'active_support/core_ext/date'
8
- require 'active_support/core_ext/numeric/time'
6
+ require 'timerizer'
9
7
10
8
module HTMLProofer
11
9
class Cache
@@ -32,7 +30,7 @@ def initialize(logger, options)
32
30
end
33
31
34
32
def within_timeframe? ( time )
35
- ( @parsed_timeframe ..@cache_time ) . cover? ( time )
33
+ ( @parsed_timeframe ..@cache_time ) . cover? ( Time . parse ( time ) )
36
34
end
37
35
38
36
def urls
@@ -45,7 +43,7 @@ def size
45
43
46
44
def parsed_timeframe ( timeframe )
47
45
time , date = timeframe . match ( /(\d +)(\D )/ ) . captures
48
- time = time . to_f
46
+ time = time . to_i
49
47
case date
50
48
when 'M'
51
49
time . months . ago
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ def run
21
21
22
22
def is_immediate_redirect?
23
23
# allow any instant-redirect meta tag
24
- @html . xpath ( "//meta[@http-equiv='refresh']" ) . attribute ( 'content' ) . value . starts_with ? '0;' rescue false
24
+ @html . xpath ( "//meta[@http-equiv='refresh']" ) . attribute ( 'content' ) . value . start_with ? '0;' rescue false
25
25
end
26
26
27
27
end
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def run
46
46
check_sri ( line , content ) if @link . check_sri? && node . name == 'link'
47
47
# we need to skip these for now; although the domain main be valid,
48
48
# curl/Typheous inaccurately return 404s for some links. cc https://git.io/vyCFx
49
- next if @link . try ( :rel ) == 'dns-prefetch'
49
+ next if @link . respond_to? ( :rel ) && @link . rel == 'dns-prefetch'
50
50
add_to_external_urls ( @link . href )
51
51
next
52
52
elsif !@link . internal? && !@link . exists?
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ def initialize(obj, check)
30
30
31
31
@html = check . html
32
32
33
- parent_attributes = obj . ancestors . map { |a | a . try ( :attributes ) }
33
+ parent_attributes = obj . ancestors . map { |a | a . respond_to? ( :attributes ) && a . attributes }
34
34
parent_attributes . pop # remove document at the end
35
35
@parent_ignorable = parent_attributes . any? { |a | !a [ 'data-proofer-ignore' ] . nil? }
36
36
Original file line number Diff line number Diff line change @@ -62,7 +62,7 @@ def call(env)
62
62
rescue
63
63
return result # Invalid encoding; it's not gonna be html.
64
64
end
65
- if HTML_SIGNATURE . any? { |sig | html . upcase . starts_with ? sig }
65
+ if HTML_SIGNATURE . any? { |sig | html . upcase . start_with ? sig }
66
66
parsed = HTMLProofer ::Runner . new (
67
67
'response' ,
68
68
Middleware . options
You can’t perform that action at this time.
0 commit comments