Class: CodeChurnPresenter
- Inherits:
-
Object
- Object
- CodeChurnPresenter
- Defined in:
- lib/tipster/presenters/code_churn_presenter.rb
Instance Method Summary collapse
- #change_list ⇒ Object
- #current_commit_id ⇒ Object
- #git_output ⇒ Object
-
#initialize(id = current_commit_id) ⇒ CodeChurnPresenter
constructor
A new instance of CodeChurnPresenter.
- #pass? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(id = current_commit_id) ⇒ CodeChurnPresenter
Returns a new instance of CodeChurnPresenter.
9 10 11 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 9 def initialize(id = current_commit_id) @commit_id = id end |
Instance Method Details
#change_list ⇒ Object
27 28 29 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 27 def change_list CommitHistoryContext.new(git_output).change_list end |
#current_commit_id ⇒ Object
19 20 21 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 19 def current_commit_id LatestCommit.new.id end |
#git_output ⇒ Object
23 24 25 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 23 def git_output FilesChanged.new(@commit_id).list end |
#pass? ⇒ Boolean
13 14 15 16 17 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 13 def pass? code_ratio_heuristic = CodeChurnHeuristic.new code_ratio_heuristic.apply change_list code_ratio_heuristic.pass? end |
#status ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'lib/tipster/presenters/code_churn_presenter.rb', line 31 def status safe = pass? result = 'Warning: Your commit is risky due to high churn.' if safe result = 'Your commit does not include any high-churn files.' end HeuristicStatus.new(safe ,result) end |