Class: Policial::Investigation
- Inherits:
-
Object
- Object
- Policial::Investigation
- Defined in:
- lib/policial/investigation.rb
Overview
Public: Starting with unparsed data coming from a pull request event, it checks all changes introduced looking for style guide violations. It also accuse all present violations through comments on all relevant lines in the pull request.
Instance Attribute Summary collapse
-
#pull_request ⇒ Object
Returns the value of attribute pull_request.
-
#violations ⇒ Object
Returns the value of attribute violations.
Instance Method Summary collapse
- #accuse ⇒ Object
-
#initialize(pull_request) ⇒ Investigation
constructor
A new instance of Investigation.
- #run ⇒ Object
Constructor Details
#initialize(pull_request) ⇒ Investigation
Returns a new instance of Investigation.
9 10 11 |
# File 'lib/policial/investigation.rb', line 9 def initialize(pull_request) @pull_request = pull_request end |
Instance Attribute Details
#pull_request ⇒ Object
Returns the value of attribute pull_request.
7 8 9 |
# File 'lib/policial/investigation.rb', line 7 def pull_request @pull_request end |
#violations ⇒ Object
Returns the value of attribute violations.
7 8 9 |
# File 'lib/policial/investigation.rb', line 7 def violations @violations end |
Instance Method Details
#accuse ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/policial/investigation.rb', line 17 def accuse return if @violations.blank? commenter = Commenter.new(@pull_request) @violations.each do |violation| if accusation_policy.allowed_for?(violation) commenter.comment_violation(violation) end end end |
#run ⇒ Object
13 14 15 |
# File 'lib/policial/investigation.rb', line 13 def run @violations ||= StyleChecker.new(@pull_request).violations end |