107 lines
3.1 KiB
C#
107 lines
3.1 KiB
C#
using MarketAlly.GitCommitEditor.Resources;
|
|
|
|
namespace MarketAlly.GitCommitEditor.Models.HistoryHealth;
|
|
|
|
/// <summary>
|
|
/// Options for history health analysis.
|
|
/// </summary>
|
|
public sealed class HistoryAnalysisOptions
|
|
{
|
|
/// <summary>
|
|
/// Analysis depth - affects number of commits analyzed.
|
|
/// </summary>
|
|
public AnalysisDepth Depth { get; set; } = AnalysisDepth.Standard;
|
|
|
|
/// <summary>
|
|
/// Maximum commits to analyze. Overrides Depth if set.
|
|
/// </summary>
|
|
public int? MaxCommitsToAnalyze { get; set; }
|
|
|
|
/// <summary>
|
|
/// Only analyze commits since this date.
|
|
/// </summary>
|
|
public DateTimeOffset? AnalyzeSince { get; set; }
|
|
|
|
/// <summary>
|
|
/// Include duplicate commit detection.
|
|
/// </summary>
|
|
public bool IncludeDuplicateDetection { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Include branch complexity analysis.
|
|
/// </summary>
|
|
public bool IncludeBranchAnalysis { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Include message quality distribution.
|
|
/// </summary>
|
|
public bool IncludeMessageDistribution { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Branches to exclude from analysis.
|
|
/// </summary>
|
|
public string[] ExcludeBranches { get; set; } = [];
|
|
|
|
/// <summary>
|
|
/// Generate cleanup suggestions.
|
|
/// </summary>
|
|
public bool GenerateCleanupSuggestions { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// Gets the effective max commits based on depth.
|
|
/// </summary>
|
|
public int EffectiveMaxCommits => MaxCommitsToAnalyze ?? Depth switch
|
|
{
|
|
AnalysisDepth.Quick => 200,
|
|
AnalysisDepth.Standard => 1000,
|
|
AnalysisDepth.Deep => 5000,
|
|
AnalysisDepth.Full => int.MaxValue,
|
|
_ => 1000
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// Scoring weights for health calculation.
|
|
/// </summary>
|
|
public sealed class HealthScoringWeights
|
|
{
|
|
public double DuplicateWeight { get; set; } = 0.20;
|
|
public double MergeWeight { get; set; } = 0.25;
|
|
public double BranchWeight { get; set; } = 0.20;
|
|
public double MessageWeight { get; set; } = 0.25;
|
|
public double AuthorshipWeight { get; set; } = 0.10;
|
|
|
|
public void Validate()
|
|
{
|
|
var sum = DuplicateWeight + MergeWeight + BranchWeight + MessageWeight + AuthorshipWeight;
|
|
if (Math.Abs(sum - 1.0) > 0.001)
|
|
throw new InvalidOperationException(Str.Validation_WeightsSum(sum));
|
|
}
|
|
|
|
public static HealthScoringWeights Default => new();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Options for duplicate detection.
|
|
/// </summary>
|
|
public sealed class DuplicateDetectionOptions
|
|
{
|
|
public bool DetectExactTreeDuplicates { get; set; } = true;
|
|
public bool DetectCherryPicks { get; set; } = true;
|
|
public bool DetectFuzzyMatches { get; set; } = true;
|
|
public int FuzzyMatchThreshold { get; set; } = 3;
|
|
public int TimeWindowMinutes { get; set; } = 5;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Progress information during analysis.
|
|
/// </summary>
|
|
public sealed class AnalysisProgress
|
|
{
|
|
public string CurrentStage { get; init; } = string.Empty;
|
|
public int PercentComplete { get; init; }
|
|
public int CommitsProcessed { get; init; }
|
|
public int TotalCommits { get; init; }
|
|
public string? CurrentItem { get; init; }
|
|
}
|