Class: Inputs::RubocopJson
- Inherits:
-
Object
- Object
- Inputs::RubocopJson
- Defined in:
- lib/stash_pull_request_commenter/inputs/rubocop_json.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
Returns the value of attribute filename.
Instance Method Summary collapse
- #comments ⇒ Object
-
#initialize(filename = 'rubocop.json') ⇒ RubocopJson
constructor
A new instance of RubocopJson.
Constructor Details
#initialize(filename = 'rubocop.json') ⇒ RubocopJson
Returns a new instance of RubocopJson.
8 9 10 11 12 |
# File 'lib/stash_pull_request_commenter/inputs/rubocop_json.rb', line 8 def initialize(filename = 'rubocop.json') self.filename = filename fail "#{filename} does not exist" unless File.exist?(filename) end |
Instance Attribute Details
#filename ⇒ Object
Returns the value of attribute filename.
6 7 8 |
# File 'lib/stash_pull_request_commenter/inputs/rubocop_json.rb', line 6 def filename @filename end |
Instance Method Details
#comments ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/stash_pull_request_commenter/inputs/rubocop_json.rb', line 14 def comments report['files'].map do |file| file['offenses'].map do |offense| Comment.new( file: file['path'], line: offense['location']['line'], text: offense['message'] ) end end.flatten end |