MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / add

Method add

atomic-core/src/change/credit.rs:468–485  ·  view source on GitHub ↗

Add a credit to the statistics.

(&mut self, credit: &Credit)

Source from the content-addressed store, hash-verified

466
467 /// Add a credit to the statistics.
468 pub fn add(&mut self, credit: &Credit) {
469 self.total_lines += 1;
470
471 match credit.credit_type {
472 CreditType::Human => self.human_lines += 1,
473 CreditType::AiAssisted => self.ai_assisted_lines += 1,
474 CreditType::Collaborative => self.collaborative_lines += 1,
475 CreditType::AiGenerated => self.ai_generated_lines += 1,
476 CreditType::Unknown => self.unknown_lines += 1,
477 }
478
479 if let Some(ref vendor) = credit.ai_vendor {
480 let vendor_name = vendor.name().to_string();
481 if !self.ai_vendors.contains(&vendor_name) {
482 self.ai_vendors.push(vendor_name);
483 }
484 }
485 }
486
487 /// Get the percentage of lines involving AI.
488 pub fn ai_percentage(&self) -> f64 {

Callers 4

statsMethod · 0.45
test_credit_stats_addFunction · 0.45
test_credit_stats_mergeFunction · 0.45

Calls 3

nameMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45

Tested by 3

test_credit_stats_addFunction · 0.36
test_credit_stats_mergeFunction · 0.36