Class: CodeRatioPresenter
- Inherits:
-
Object
- Object
- CodeRatioPresenter
- Defined in:
- lib/tipster/presenters/code_ratio_presenter.rb
Instance Method Summary collapse
- #change_list ⇒ Object
- #current_commit_id ⇒ Object
- #git_output ⇒ Object
-
#initialize(id = current_commit_id) ⇒ CodeRatioPresenter
constructor
A new instance of CodeRatioPresenter.
- #pass? ⇒ Boolean
- #status ⇒ Object
Constructor Details
#initialize(id = current_commit_id) ⇒ CodeRatioPresenter
Returns a new instance of CodeRatioPresenter.
9 10 11 |
# File 'lib/tipster/presenters/code_ratio_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_ratio_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_ratio_presenter.rb', line 19 def current_commit_id LatestCommit.new.id end |
#git_output ⇒ Object
23 24 25 |
# File 'lib/tipster/presenters/code_ratio_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_ratio_presenter.rb', line 13 def pass? code_ratio_heuristic = CodeRatioHeuristic.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_ratio_presenter.rb', line 31 def status safe = pass? result = 'Warning: Your commit is risky due to a lack of tests. Consider adding more tests and amending your commit.' if safe result = 'Your commit has adequate tests and will not be flagged as risky.' end HeuristicStatus.new(safe ,result) end |