blinkr 0.3.5 → 0.3.6
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 +4 -4
- data/lib/blinkr/config.rb +8 -1
- data/lib/blinkr/error.rb +1 -1
- data/lib/blinkr/extensions/img_alt.rb +1 -1
- data/lib/blinkr/extensions/inline_css.rb +4 -2
- data/lib/blinkr/extensions/links.rb +17 -17
- data/lib/blinkr/extensions/meta.rb +0 -1
- data/lib/blinkr/report.rb +0 -1
- data/lib/blinkr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aea80c9c477eab4ce09539b9b697ef2401a33b0
|
4
|
+
data.tar.gz: 7d57e314a280981c97c9829f975bd138ba65302d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d00baebd8c848e05d7501cc7fda16f79fc36ff98fdeb587850cfff6fe7c78f4b1c2e5f755223e18f5ce2f1196bcc2ae82900e772ac857d23750996fb59d698d6
|
7
|
+
data.tar.gz: 60701213a46677ac5bb75701ec7a09f4f9a0b9bc03fead126eb3296a2c8eb1b924548376f8a6fb48f394ea8c5d1b2becfe82afb7fb08eb271e45be095ee028f7
|
data/lib/blinkr/config.rb
CHANGED
@@ -39,7 +39,14 @@ module Blinkr
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def ignored? url, code, message
|
42
|
-
|
42
|
+
return false if uril.nil? || code.nil? || message.nil?
|
43
|
+
|
44
|
+
ignores.any? do |ignore|
|
45
|
+
return true if ignore.has_key?('url') && ignore['url'].match(url)
|
46
|
+
return true if ignore.has_key?('code') && ignore['code'] == code
|
47
|
+
return true if ignore.has_key?('message') && ignore['message'].match(message)
|
48
|
+
false
|
49
|
+
end
|
43
50
|
end
|
44
51
|
|
45
52
|
def skipped? url
|
data/lib/blinkr/error.rb
CHANGED
@@ -7,7 +7,7 @@ module Blinkr
|
|
7
7
|
raise TypeError 'severity must be a string or symbol' unless opts[:severity].is_a?(String) || opts[:severity].is_a?(Symbol)
|
8
8
|
raise 'severity not a recognized value' unless SEVERITY.include? opts[:severity].to_sym
|
9
9
|
|
10
|
-
@severity = opts[:severity]
|
10
|
+
@severity = opts[:severity].to_sym
|
11
11
|
@category = opts[:category]
|
12
12
|
@type = opts[:type]
|
13
13
|
@title = opts[:title]
|
@@ -10,7 +10,7 @@ module Blinkr
|
|
10
10
|
|
11
11
|
def collect page
|
12
12
|
page.body.css('img:not([alt])').each do |img|
|
13
|
-
page.errors <<
|
13
|
+
page.errors << ::Blinkr::Error.new({:severity => :warning, :category => 'SEO',
|
14
14
|
:type => '<img alt=""> missing',
|
15
15
|
:title => "#{img['src']} (line #{img.line})",
|
16
16
|
:message => '<img alt=""> missing', :snippet => img.to_s,
|
@@ -10,18 +10,20 @@ module Blinkr
|
|
10
10
|
|
11
11
|
def collect page
|
12
12
|
page.body.css('[style]').each do |elm|
|
13
|
+
elm_clone = Nokogiri.make(elm.to_s)
|
14
|
+
elm_clone.inner_html = ""
|
13
15
|
if elm['style'] == ""
|
14
16
|
page.errors << Blinkr::Error.new({:severity => 'info', :category => 'HTML Compatibility/Correctness',
|
15
17
|
:type => 'style attribute is empty',
|
16
18
|
:title => %Q{"#{elm['style']}" (line #{elm.line})},
|
17
|
-
:message => 'style attribute is empty', :snippet =>
|
19
|
+
:message => 'style attribute is empty', :snippet => elm_clone.to_s,
|
18
20
|
:icon => 'fa-info'})
|
19
21
|
else
|
20
22
|
page.errors << Blinkr::Error.new({:severity => 'info',
|
21
23
|
:category => 'HTML Compatibility/Correctness',
|
22
24
|
:type => 'Inline CSS detected',
|
23
25
|
:title => %Q{"#{elm['style']}" (line #{elm.line})},
|
24
|
-
:message => 'inline style', :snippet =>
|
26
|
+
:message => 'inline style', :snippet => elm_clone.to_s,
|
25
27
|
:icon => 'fa-info'})
|
26
28
|
end
|
27
29
|
end
|
@@ -33,8 +33,8 @@ module Blinkr
|
|
33
33
|
puts '----------------------'
|
34
34
|
start = DateTime.now
|
35
35
|
|
36
|
-
external_links = @links.reject { |k| k.start_with? @config.base_url }
|
37
36
|
processed = 0
|
37
|
+
|
38
38
|
# Find the internal links
|
39
39
|
@links.select{|k| k.start_with? @config.base_url}.each do |url, locations|
|
40
40
|
# TODO figure out what to do about relative links
|
@@ -59,32 +59,32 @@ module Blinkr
|
|
59
59
|
})
|
60
60
|
# It wasn't in the sitemap, so we'll add it to the "external_links" to still be checked
|
61
61
|
end
|
62
|
-
external_links[link.to_s] = locations
|
63
62
|
end
|
64
63
|
end
|
65
|
-
|
64
|
+
@links.each do |url, metadata|
|
66
65
|
# if link start_with? @config.base_url check to see if it's in the sitemap.xml
|
67
66
|
browser.process(url, @config.max_retrys, :method => :get, :followlocation => true, :timeout => 30,
|
68
67
|
:cookiefile => '_tmp/cookies', :cookiejar => '_tmp/cookies',
|
69
68
|
:connecttimeout => 10, :maxredirs => 3) do |resp|
|
70
69
|
puts "Loaded #{url} via #{browser.name} #{'(cached)' if resp.cached?}" if @config.verbose
|
71
70
|
|
72
|
-
|
71
|
+
resp_code = resp.code.to_i
|
72
|
+
if resp_code < 200 || ((resp_code > 300 && resp_code < 400) && @config.warning_on_300s) || resp_code > 400
|
73
73
|
response = resp
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
end
|
75
|
+
detail = nil
|
76
|
+
if response.status_message.nil?
|
77
|
+
message = response.return_message
|
78
|
+
else
|
79
|
+
message = response.status_message
|
80
|
+
detail = response.return_message unless resp.return_message == 'No error'
|
81
|
+
end
|
83
82
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
83
|
+
severity = :danger
|
84
|
+
if response.code.to_i >= 300 && response.code.to_i < 400
|
85
|
+
severity = :warning
|
86
|
+
end
|
87
|
+
metadata.each do |src|
|
88
88
|
src[:page].errors << Blinkr::Error.new({:severity => severity,
|
89
89
|
:category => 'Resources missing',
|
90
90
|
:type => '<a href=""> target cannot be loaded',
|
@@ -95,7 +95,7 @@ module Blinkr
|
|
95
95
|
end
|
96
96
|
end
|
97
97
|
processed += 1
|
98
|
-
puts "Processed #{processed} of #{
|
98
|
+
puts "Processed #{processed} of #{@links.size}" if @config.verbose
|
99
99
|
end
|
100
100
|
end
|
101
101
|
browser.hydra.run if browser.is_a? Blinkr::TyphoeusWrapper
|
data/lib/blinkr/report.rb
CHANGED
data/lib/blinkr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blinkr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pete Muir
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-09-
|
12
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|