Get more details from PyLint

This commit is contained in:
Sebastian Serth
2020-10-24 16:11:12 +02:00
parent 9beefd0feb
commit 380b1a5ba1

View File

@ -1,6 +1,6 @@
class PyLintAdapter < TestingFrameworkAdapter
REGEXP = /Your code has been rated at (-?\d+\.?\d*)\/(\d+\.?\d*)/
ASSERTION_ERROR_REGEXP = /^.*?\([^,]*?,\ ([^,]*?),[^,]*?\)\ (.*?)$/
ASSERTION_ERROR_REGEXP = /^.*?\.py:(\d+):.*?\([^,]*?,\ ([^,]*?),([^,]*?)\)\ (.*?)$/
def self.framework_name
'PyLint'
@ -21,9 +21,12 @@ class PyLintAdapter < TestingFrameworkAdapter
begin
assertion_error_matches = Timeout.timeout(2.seconds) do
output[:stdout].scan(ASSERTION_ERROR_REGEXP).map do |match|
test = match.first.strip
description = match.second.strip
{test: test, description: description}
line_no = match.first.strip
test = match.second.strip
# e.g. function name, nil if outside of a function. Not always available
context = match.third.strip.presence
description = match.fourth.strip
{test: test, description: description, context: context, line: line_no}
end || []
end
rescue Timeout::Error