Class: StudFinder::TemporalCoupling
- Inherits:
-
Object
- Object
- StudFinder::TemporalCoupling
- Defined in:
- lib/stud_finder/temporal_coupling.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- SHA_PATTERN =
/\A[0-9a-f]{40}\z/
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(repo_path:, files:, days:, min_co_changes: 5, coupling_threshold: 0.30) ⇒ TemporalCoupling
constructor
A new instance of TemporalCoupling.
Constructor Details
#initialize(repo_path:, files:, days:, min_co_changes: 5, coupling_threshold: 0.30) ⇒ TemporalCoupling
Returns a new instance of TemporalCoupling.
11 12 13 14 15 16 17 |
# File 'lib/stud_finder/temporal_coupling.rb', line 11 def initialize(repo_path:, files:, days:, min_co_changes: 5, coupling_threshold: 0.30) @repo_path = File.(repo_path) @file_set = files.to_h { |f| [f, true] } @days = days @min_co_changes = min_co_changes @coupling_threshold = coupling_threshold end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/stud_finder/temporal_coupling.rb', line 19 def call stdout, _err, status = git_log return Result.new(pairs: {}, warnings: ['git_error']) unless status.success? commits = parse_commits(stdout) co_matrix = build_co_change_matrix(commits) own_changes = build_own_changes(commits) Result.new(pairs: build_pairs(co_matrix, own_changes), warnings: []) rescue Errno::ENOENT Result.new(pairs: {}, warnings: ['git_not_found']) end |