lib/coconductor/commands/detect.rb in coconductor-0.8.1 vs lib/coconductor/commands/detect.rb in coconductor-0.8.2
- old
+ new
@@ -28,10 +28,11 @@
end
print_table rows
return unless code_of_conduct_file && (options[:code_of_conduct] || options[:diff])
+
expected_code_of_conduct = options[:code_of_conduct] || closest_code_of_conduct
return unless expected_code_of_conduct
invoke(:diff, nil,
code_of_conduct: expected_code_of_conduct,
@@ -40,9 +41,10 @@
private
def closest_code_of_conduct
return unless code_of_conduct_file
+
matcher = Coconductor::Matchers::Dice.new(code_of_conduct_file)
matches = matcher.matches_by_similarity
matches.first.first.key unless matches.empty?
end