site-inspector 3.1.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -1
  3. data/.rubocop.yml +18 -10
  4. data/.rubocop_todo.yml +139 -0
  5. data/.ruby-version +1 -1
  6. data/Gemfile +4 -0
  7. data/Guardfile +2 -0
  8. data/Rakefile +2 -0
  9. data/bin/site-inspector +7 -6
  10. data/lib/cliver/dependency_ext.rb +6 -3
  11. data/lib/site-inspector.rb +18 -11
  12. data/lib/site-inspector/cache.rb +2 -0
  13. data/lib/site-inspector/checks/accessibility.rb +30 -22
  14. data/lib/site-inspector/checks/check.rb +4 -2
  15. data/lib/site-inspector/checks/content.rb +15 -4
  16. data/lib/site-inspector/checks/cookies.rb +5 -3
  17. data/lib/site-inspector/checks/dns.rb +13 -11
  18. data/lib/site-inspector/checks/headers.rb +8 -6
  19. data/lib/site-inspector/checks/hsts.rb +16 -12
  20. data/lib/site-inspector/checks/https.rb +3 -1
  21. data/lib/site-inspector/checks/sniffer.rb +10 -7
  22. data/lib/site-inspector/checks/wappalyzer.rb +62 -0
  23. data/lib/site-inspector/checks/whois.rb +36 -0
  24. data/lib/site-inspector/disk_cache.rb +2 -0
  25. data/lib/site-inspector/domain.rb +36 -30
  26. data/lib/site-inspector/endpoint.rb +22 -23
  27. data/lib/site-inspector/rails_cache.rb +2 -0
  28. data/lib/site-inspector/version.rb +3 -1
  29. data/package-lock.json +505 -0
  30. data/package.json +1 -1
  31. data/script/pa11y-version +1 -0
  32. data/site-inspector.gemspec +24 -17
  33. data/spec/checks/site_inspector_endpoint_accessibility_spec.rb +15 -13
  34. data/spec/checks/site_inspector_endpoint_check_spec.rb +9 -7
  35. data/spec/checks/site_inspector_endpoint_content_spec.rb +30 -21
  36. data/spec/checks/site_inspector_endpoint_cookies_spec.rb +17 -15
  37. data/spec/checks/site_inspector_endpoint_dns_spec.rb +42 -40
  38. data/spec/checks/site_inspector_endpoint_headers_spec.rb +12 -10
  39. data/spec/checks/site_inspector_endpoint_hsts_spec.rb +27 -25
  40. data/spec/checks/site_inspector_endpoint_https_spec.rb +12 -10
  41. data/spec/checks/site_inspector_endpoint_sniffer_spec.rb +33 -31
  42. data/spec/checks/site_inspector_endpoint_wappalyzer_spec.rb +34 -0
  43. data/spec/checks/site_inspector_endpoint_whois_spec.rb +26 -0
  44. data/spec/fixtures/wappalyzer.json +125 -0
  45. data/spec/site_inspector_cache_spec.rb +2 -0
  46. data/spec/site_inspector_disk_cache_spec.rb +8 -6
  47. data/spec/site_inspector_domain_spec.rb +34 -34
  48. data/spec/site_inspector_endpoint_spec.rb +44 -43
  49. data/spec/site_inspector_spec.rb +15 -13
  50. data/spec/spec_helper.rb +2 -0
  51. metadata +125 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6884b52732376fcd208b761e6b441f52c8ff383d
4
- data.tar.gz: a6d6268ce73a44108f4ec490da07d7b23257981d
2
+ SHA256:
3
+ metadata.gz: 9da6e03626519a29904ac4f663565104f6793e9fedae46f786f268ea7beaf870
4
+ data.tar.gz: 100c9e6f24fd2f5ded3cc7239d37f30852eb7c7cd4a0c69651fc1d260c0043c6
5
5
  SHA512:
6
- metadata.gz: c0c672eb141da7b5522b4ea9191024a13d08f37c3d91b11b8771f649596ff38f587cc98a95ce6cf6bb80f6f060d71068a51c45d132517e7a6a4237f7cb54d9d8
7
- data.tar.gz: a1251d75b522286e2ff9889b347b4bf73440b2932f89acc9b4840d1b2c40ad7cbded89feca80e278f8120f9b1976d658860a75bd747c25921df4b55efcd365e8
6
+ metadata.gz: 974095f3bc91b3a83c90ef9fa9879942e66e3a4927b0e1d83a0cba2727c9f7e301ab151a3f0bac1ff507d3a16549c64af4be23fdd245ede0ac0dc25401096ba2
7
+ data.tar.gz: 16378f1054392ef3aa472469860367bab3c4d276bd57eaec9131382109aa85218ad535d82477d215d7c0294f310e82eac987275fd1b7d5148c5d3a1e722c8ab5
data/.gitignore CHANGED
@@ -5,4 +5,4 @@ Gemfile.lock
5
5
  /.env
6
6
  /tmp
7
7
  /cache
8
- node_modules
8
+ node_modules
@@ -1,13 +1,14 @@
1
- Metrics/LineLength:
2
- Enabled: false
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
3
6
 
4
- Style/AlignHash:
5
- EnforcedHashRocketStyle: table
6
- EnforcedColonStyle: table
7
+ AllCops:
8
+ NewCops: enable
7
9
 
8
- Lint/EndAlignment:
9
- AlignWith: variable
10
- AutoCorrect: true
10
+ Layout/LineLength:
11
+ Enabled: false
11
12
 
12
13
  Metrics/MethodLength:
13
14
  Enabled: false
@@ -18,7 +19,7 @@ Metrics/AbcSize:
18
19
  Style/Documentation:
19
20
  Enabled: false
20
21
 
21
- Style/FileName:
22
+ Naming/FileName:
22
23
  Enabled: false
23
24
 
24
25
  Metrics/CyclomaticComplexity:
@@ -29,6 +30,13 @@ Style/DoubleNegation:
29
30
 
30
31
  Metrics/ClassLength:
31
32
  Enabled: false
32
-
33
+
33
34
  Style/ClassVars:
34
35
  Enabled: false
36
+
37
+ Metrics/BlockLength:
38
+ Enabled: false
39
+
40
+ Security/MarshalLoad:
41
+ Exclude:
42
+ - lib/site-inspector/disk_cache.rb
@@ -0,0 +1,139 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2020-11-13 02:59:59 UTC using RuboCop version 1.3.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: Include.
11
+ # Include: **/*.gemspec
12
+ Gemspec/RequiredRubyVersion:
13
+ Exclude:
14
+ - 'site-inspector.gemspec'
15
+
16
+ # Offense count: 3
17
+ # Configuration parameters: AllowComments, AllowEmptyLambdas.
18
+ Lint/EmptyBlock:
19
+ Exclude:
20
+ - 'spec/site_inspector_domain_spec.rb'
21
+
22
+ # Offense count: 1
23
+ Lint/NoReturnInBeginEndBlocks:
24
+ Exclude:
25
+ - 'lib/site-inspector/endpoint.rb'
26
+
27
+ # Offense count: 2
28
+ # Configuration parameters: IgnoredMethods.
29
+ Metrics/PerceivedComplexity:
30
+ Max: 9
31
+
32
+ # Offense count: 3
33
+ # Configuration parameters: EnforcedStyleForLeadingUnderscores.
34
+ # SupportedStylesForLeadingUnderscores: disallowed, required, optional
35
+ Naming/MemoizedInstanceVariableName:
36
+ Exclude:
37
+ - 'lib/site-inspector/checks/accessibility.rb'
38
+
39
+ # Offense count: 23
40
+ # Configuration parameters: Prefixes.
41
+ # Prefixes: when, with, without
42
+ RSpec/ContextWording:
43
+ Exclude:
44
+ - 'spec/checks/site_inspector_endpoint_content_spec.rb'
45
+ - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
46
+ - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
47
+ - 'spec/site_inspector_domain_spec.rb'
48
+ - 'spec/site_inspector_endpoint_spec.rb'
49
+
50
+ # Offense count: 1
51
+ RSpec/EmptyExampleGroup:
52
+ Exclude:
53
+ - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
54
+
55
+ # Offense count: 24
56
+ # Configuration parameters: Max.
57
+ RSpec/ExampleLength:
58
+ Exclude:
59
+ - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
60
+ - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
61
+ - 'spec/checks/site_inspector_endpoint_https_spec.rb'
62
+ - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
63
+ - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
64
+ - 'spec/site_inspector_disk_cache_spec.rb'
65
+ - 'spec/site_inspector_domain_spec.rb'
66
+ - 'spec/site_inspector_endpoint_spec.rb'
67
+ - 'spec/site_inspector_spec.rb'
68
+
69
+ # Offense count: 15
70
+ # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly.
71
+ # Include: **/*_spec*rb*, **/spec/**/*
72
+ RSpec/FilePath:
73
+ Exclude:
74
+ - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
75
+ - 'spec/checks/site_inspector_endpoint_check_spec.rb'
76
+ - 'spec/checks/site_inspector_endpoint_content_spec.rb'
77
+ - 'spec/checks/site_inspector_endpoint_cookies_spec.rb'
78
+ - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
79
+ - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
80
+ - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
81
+ - 'spec/checks/site_inspector_endpoint_https_spec.rb'
82
+ - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
83
+ - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
84
+ - 'spec/checks/site_inspector_endpoint_whois_spec.rb'
85
+ - 'spec/site_inspector_cache_spec.rb'
86
+ - 'spec/site_inspector_disk_cache_spec.rb'
87
+ - 'spec/site_inspector_domain_spec.rb'
88
+ - 'spec/site_inspector_endpoint_spec.rb'
89
+
90
+ # Offense count: 55
91
+ RSpec/MultipleExpectations:
92
+ Max: 5
93
+
94
+ # Offense count: 240
95
+ # Configuration parameters: IgnoreSharedExamples.
96
+ RSpec/NamedSubject:
97
+ Exclude:
98
+ - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
99
+ - 'spec/checks/site_inspector_endpoint_check_spec.rb'
100
+ - 'spec/checks/site_inspector_endpoint_content_spec.rb'
101
+ - 'spec/checks/site_inspector_endpoint_cookies_spec.rb'
102
+ - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
103
+ - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
104
+ - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
105
+ - 'spec/checks/site_inspector_endpoint_https_spec.rb'
106
+ - 'spec/checks/site_inspector_endpoint_sniffer_spec.rb'
107
+ - 'spec/checks/site_inspector_endpoint_wappalyzer_spec.rb'
108
+ - 'spec/checks/site_inspector_endpoint_whois_spec.rb'
109
+ - 'spec/site_inspector_cache_spec.rb'
110
+ - 'spec/site_inspector_disk_cache_spec.rb'
111
+ - 'spec/site_inspector_domain_spec.rb'
112
+ - 'spec/site_inspector_endpoint_spec.rb'
113
+
114
+ # Offense count: 2
115
+ RSpec/RepeatedDescription:
116
+ Exclude:
117
+ - 'spec/checks/site_inspector_endpoint_content_spec.rb'
118
+
119
+ # Offense count: 9
120
+ RSpec/RepeatedExample:
121
+ Exclude:
122
+ - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
123
+ - 'spec/checks/site_inspector_endpoint_content_spec.rb'
124
+ - 'spec/site_inspector_domain_spec.rb'
125
+
126
+ # Offense count: 2
127
+ RSpec/RepeatedExampleGroupDescription:
128
+ Exclude:
129
+ - 'spec/site_inspector_domain_spec.rb'
130
+
131
+ # Offense count: 30
132
+ RSpec/SubjectStub:
133
+ Exclude:
134
+ - 'spec/checks/site_inspector_endpoint_accessibility_spec.rb'
135
+ - 'spec/checks/site_inspector_endpoint_dns_spec.rb'
136
+ - 'spec/checks/site_inspector_endpoint_headers_spec.rb'
137
+ - 'spec/checks/site_inspector_endpoint_hsts_spec.rb'
138
+ - 'spec/checks/site_inspector_endpoint_https_spec.rb'
139
+ - 'spec/site_inspector_endpoint_spec.rb'
@@ -1 +1 @@
1
- 2.3.0
1
+ 2.6.6
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
5
+ gem 'sniffles', github: 'wa0x6e/sniffles'
6
+
3
7
  gemspec
data/Guardfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # A sample Guardfile
2
4
  # More info at https://github.com/guard/guard#readme
3
5
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require './lib/site-inspector'
2
4
  require 'rspec/core/rake_task'
3
5
 
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'mercenary'
4
5
  require 'oj'
@@ -6,11 +7,11 @@ require 'yaml'
6
7
  require 'colorator'
7
8
  require_relative '../lib/site-inspector'
8
9
 
9
- def stringify_keys_deep!(h)
10
- h.keys.each do |k|
10
+ def stringify_keys_deep!(hash)
11
+ hash.each_key do |k|
11
12
  ks = k.respond_to?(:to_s) ? k.to_s : k
12
- h[ks] = h.delete k # Preserve order even when k == ks
13
- stringify_keys_deep! h[ks] if h[ks].is_a? Hash
13
+ hash[ks] = hash.delete k # Preserve order even when k == ks
14
+ stringify_keys_deep! h[ks] if hash[ks].is_a? Hash
14
15
  end
15
16
  end
16
17
 
@@ -45,8 +46,8 @@ Mercenary.program(:"site-inspector") do |p|
45
46
  yaml = YAML.dump Oj.load(json)
46
47
 
47
48
  # Colorize bools
48
- yaml.gsub!(/\: (true|ok)$/, ': ' + 'true'.green)
49
- yaml.gsub!(/\: false$/, ': ' + 'false'.red)
49
+ yaml.gsub!(/: (true|ok)$/, ": #{'true'.green}")
50
+ yaml.gsub!(/: false$/, ": #{'false'.red}")
50
51
 
51
52
  puts yaml
52
53
  end
@@ -1,21 +1,24 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Cliver
2
4
  class Dependency
3
5
  # Memoized shortcut for detect
4
6
  # Returns the path to the detected dependency
5
7
  # Raises an error if the dependency was not satisfied
6
8
  def path
7
- @detected_path ||= detect!
9
+ @path ||= detect!
8
10
  end
9
11
 
10
12
  # Returns the version of the resolved dependency
11
13
  def version
12
- return @detected_version if defined? @detected_version
14
+ return @version if defined? @version
15
+
13
16
  version = installed_versions.find { |p, _v| p == path }
14
17
  @detected_version = version.nil? ? nil : version[1]
15
18
  end
16
19
 
17
20
  def major_version
18
- version.split('.').first if version
21
+ version&.split('.')&.first
19
22
  end
20
23
  end
21
24
  end
@@ -1,10 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'open-uri'
2
4
  require 'addressable/uri'
3
5
  require 'public_suffix'
4
6
  require 'typhoeus'
5
7
  require 'parallel'
6
8
  require 'cliver'
9
+ require 'whois'
7
10
  require 'cgi'
11
+ require 'resolv'
12
+ require 'dotenv/load'
8
13
 
9
14
  require_relative 'site-inspector/cache'
10
15
  require_relative 'site-inspector/disk_cache'
@@ -19,6 +24,8 @@ require_relative 'site-inspector/checks/hsts'
19
24
  require_relative 'site-inspector/checks/https'
20
25
  require_relative 'site-inspector/checks/sniffer'
21
26
  require_relative 'site-inspector/checks/cookies'
27
+ require_relative 'site-inspector/checks/whois'
28
+ require_relative 'site-inspector/checks/wappalyzer'
22
29
  require_relative 'site-inspector/endpoint'
23
30
  require_relative 'site-inspector/version'
24
31
  require_relative 'cliver/dependency_ext'
@@ -29,12 +36,12 @@ class SiteInspector
29
36
 
30
37
  def cache
31
38
  @cache ||= if ENV['CACHE']
32
- SiteInspector::DiskCache.new
33
- elsif Object.const_defined?('Rails')
34
- SiteInspector::RailsCache.new
35
- else
36
- SiteInspector::Cache.new
37
- end
39
+ SiteInspector::DiskCache.new
40
+ elsif Object.const_defined?('Rails')
41
+ SiteInspector::RailsCache.new
42
+ else
43
+ SiteInspector::Cache.new
44
+ end
38
45
  end
39
46
 
40
47
  def timeout
@@ -47,11 +54,11 @@ class SiteInspector
47
54
 
48
55
  def typhoeus_defaults
49
56
  defaults = {
50
- followlocation: false,
51
- timeout: SiteInspector.timeout,
57
+ followlocation: false,
58
+ timeout: SiteInspector.timeout,
52
59
  accept_encoding: 'gzip',
53
- method: :head,
54
- headers: {
60
+ method: :head,
61
+ headers: {
55
62
  'User-Agent' => "Mozilla/5.0 (compatible; SiteInspector/#{SiteInspector::VERSION}; +https://github.com/benbalter/site-inspector)"
56
63
  }
57
64
  }
@@ -67,7 +74,7 @@ class SiteInspector
67
74
  end
68
75
 
69
76
  if ENV['DEBUG']
70
- Ethon.logger = Logger.new(STDOUT)
77
+ Ethon.logger = Logger.new($stdout)
71
78
  Ethon.logger.level = Logger::DEBUG
72
79
  Typhoeus::Config.verbose = true
73
80
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class SiteInspector
2
4
  class Cache
3
5
  def memory
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'json'
2
4
  require 'open3'
3
5
 
@@ -7,24 +9,28 @@ class SiteInspector
7
9
  class Pa11yError < RuntimeError; end
8
10
 
9
11
  STANDARDS = {
10
- section508: 'Section508', # Default standard
11
- wcag2a: 'WCAG2A',
12
- wcag2aa: 'WCAG2AA',
13
- wcag2aaa: 'WCAG2AAA'
14
- }
12
+ wcag2a: 'WCAG2A', # Default standard
13
+ wcag2aa: 'WCAG2AA',
14
+ wcag2aaa: 'WCAG2AAA',
15
+ section508: 'Section508'
16
+ }.freeze
15
17
 
16
18
  DEFAULT_LEVEL = :error
17
19
 
18
- REQUIRED_PA11Y_VERSION = '~> 2.1'
20
+ REQUIRED_PA11Y_VERSION = '~> 5.0'
19
21
 
20
22
  class << self
21
23
  def pa11y_version
22
- @pa11y_version ||= pa11y.version
24
+ @pa11y_version ||= begin
25
+ output, status = run_command('--version')
26
+ output.strip if status.exitstatus.zero?
27
+ end
23
28
  end
24
29
 
25
30
  def pa11y?
26
31
  return @pa11y_detected if defined? @pa11y_detected
27
- @pa11y_detected = !!(pa11y.detect)
32
+
33
+ @pa11y_detected = !!pa11y.detect
28
34
  end
29
35
 
30
36
  def enabled?
@@ -35,9 +41,13 @@ class SiteInspector
35
41
  @pa11y ||= begin
36
42
  node_bin = File.expand_path('../../../node_modules/pa11y/bin', File.dirname(__FILE__))
37
43
  path = ['*', node_bin].join(File::PATH_SEPARATOR)
38
- Cliver::Dependency.new('pa11y', REQUIRED_PA11Y_VERSION, path: path)
44
+ Cliver::Dependency.new('pa11y.js', REQUIRED_PA11Y_VERSION, path: path)
39
45
  end
40
46
  end
47
+
48
+ def run_command(args)
49
+ Open3.capture2e(pa11y.detect, *args)
50
+ end
41
51
  end
42
52
 
43
53
  def level
@@ -45,12 +55,13 @@ class SiteInspector
45
55
  end
46
56
 
47
57
  def level=(level)
48
- fail ArgumentError, "Invalid level '#{level}'" unless [:error, :warning, :notice].include?(level)
58
+ raise ArgumentError, "Invalid level '#{level}'" unless %i[error warning notice].include?(level)
59
+
49
60
  @level = level
50
61
  end
51
62
 
52
63
  def standard?(standard)
53
- STANDARDS.keys.include?(standard)
64
+ STANDARDS.key?(standard)
54
65
  end
55
66
 
56
67
  def standard
@@ -58,7 +69,8 @@ class SiteInspector
58
69
  end
59
70
 
60
71
  def standard=(standard)
61
- fail ArgumentError, "Unknown standard '#{standard}'" unless standard?(standard)
72
+ raise ArgumentError, "Unknown standard '#{standard}'" unless standard?(standard)
73
+
62
74
  @standard = standard
63
75
  end
64
76
 
@@ -75,7 +87,7 @@ class SiteInspector
75
87
  rescue Pa11yError
76
88
  nil
77
89
  end
78
- alias_method :to_h, :check
90
+ alias to_h check
79
91
 
80
92
  def method_missing(method_sym, *arguments, &block)
81
93
  if standard?(method_sym)
@@ -85,7 +97,7 @@ class SiteInspector
85
97
  end
86
98
  end
87
99
 
88
- def respond_to?(method_sym, include_private = false)
100
+ def respond_to_missing?(method_sym, include_private = false)
89
101
  if standard?(method_sym)
90
102
  true
91
103
  else
@@ -97,7 +109,7 @@ class SiteInspector
97
109
 
98
110
  def run_pa11y(standard)
99
111
  self.class.pa11y.detect! unless ENV['SKIP_PA11Y_CHECK']
100
- fail ArgumentError, "Unknown standard '#{standard}'" unless standard?(standard)
112
+ raise ArgumentError, "Unknown standard '#{standard}'" unless standard?(standard)
101
113
 
102
114
  args = [
103
115
  '--standard', STANDARDS[standard],
@@ -105,23 +117,19 @@ class SiteInspector
105
117
  '--level', level.to_s,
106
118
  endpoint.uri.to_s
107
119
  ]
108
- output, status = run_command(args)
120
+ output, status = self.class.run_command(args)
109
121
 
110
122
  # Pa11y exit codes: https://github.com/nature/pa11y#exit-codes
111
123
  # 0: No errors, 1: Technical error within pa11y, 2: accessibility error (configurable via --level)
112
- fail Pa11yError if status == 1
124
+ raise Pa11yError if status.exitstatus == 1
113
125
 
114
126
  {
115
- valid: status == 0,
127
+ valid: status.exitstatus.zero?,
116
128
  results: JSON.parse(output)
117
129
  }
118
130
  rescue Pa11yError, JSON::ParserError
119
131
  raise Pa11yError, "Command `pa11y #{args.join(' ')}` failed: #{output}"
120
132
  end
121
-
122
- def run_command(args)
123
- Open3.capture2e(self.class.pa11y.path, *args)
124
- end
125
133
  end
126
134
  end
127
135
  end