Class: RubocopJunitFailure

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop_junit_parser/rubocop_junit_failure.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(failure:, path: Dir.pwd) ⇒ RubocopJunitFailure

Returns a new instance of RubocopJunitFailure.



4
5
6
7
8
9
# File 'lib/rubocop_junit_parser/rubocop_junit_failure.rb', line 4

def initialize(failure:, path: Dir.pwd)
  file_matches = failure.children.first.text.strip.match(file_path_regex)
  self.file_path = file_matches[1].gsub("#{path}/", '')
  self.message = failure.attributes['message'].value
  self.line = file_matches[2].to_i
end

Instance Attribute Details

#file_pathObject

Returns the value of attribute file_path.



2
3
4
# File 'lib/rubocop_junit_parser/rubocop_junit_failure.rb', line 2

def file_path
  @file_path
end

#lineObject

Returns the value of attribute line.



2
3
4
# File 'lib/rubocop_junit_parser/rubocop_junit_failure.rb', line 2

def line
  @line
end

#messageObject

Returns the value of attribute message.



2
3
4
# File 'lib/rubocop_junit_parser/rubocop_junit_failure.rb', line 2

def message
  @message
end

#severityObject

Returns the value of attribute severity.



2
3
4
# File 'lib/rubocop_junit_parser/rubocop_junit_failure.rb', line 2

def severity
  @severity
end