diff --git a/lib/scss_lint/reporter/tap_reporter.rb b/lib/scss_lint/reporter/tap_reporter.rb index 30b9bf6e..098e8357 100644 --- a/lib/scss_lint/reporter/tap_reporter.rb +++ b/lib/scss_lint/reporter/tap_reporter.rb @@ -86,16 +86,25 @@ def format_ok(file, test_number) def format_not_ok(lint, test_number) location = lint.location test_line_description = "#{lint.filename}:#{location.line}:#{location.column}" - test_line_description += " #{lint.linter.name}" if lint.linter + + data = { + 'message' => lint.description, + 'severity' => lint.severity.to_s, + 'file' => lint.filename, + 'line' => lint.location.line, + 'column' => lint.location.column, + } + + if lint.linter + test_line_description += " #{lint.linter.name}" if lint.linter + data['name'] = lint.linter.name + end + + data_yaml = data.to_yaml.strip.gsub(/^/, ' ') <<-EOS.strip not ok #{test_number} - #{test_line_description} - --- - message: #{lint.description} - severity: #{lint.severity} - file: #{lint.filename} - line: #{lint.location.line} - column: #{lint.location.column} +#{data_yaml} ... EOS end diff --git a/spec/scss_lint/reporter/tap_reporter_spec.rb b/spec/scss_lint/reporter/tap_reporter_spec.rb index 1c2a73e8..70c7c46e 100644 --- a/spec/scss_lint/reporter/tap_reporter_spec.rb +++ b/spec/scss_lint/reporter/tap_reporter_spec.rb @@ -70,6 +70,7 @@ file: not-ok1.scss line: 123 column: 10 + name: SCSSLint::Linter::PrivateNamingConvention ... not ok 3 - not-ok2.scss:20:2 SCSSLint::Linter::PrivateNamingConvention --- @@ -78,6 +79,7 @@ file: not-ok2.scss line: 20 column: 2 + name: SCSSLint::Linter::PrivateNamingConvention ... not ok 4 - not-ok2.scss:21:3 SCSSLint::Linter::PrivateNamingConvention --- @@ -86,6 +88,7 @@ file: not-ok2.scss line: 21 column: 3 + name: SCSSLint::Linter::PrivateNamingConvention ... ok 5 - ok2.scss EOS