Finalizes new model for separating processing of scan result adds from final results and adds sorting for languages. (#254)

This commit is contained in:
Guy Acosta 2020-07-28 10:42:28 -06:00 коммит произвёл GitHub
Родитель 4fbf6b1dda
Коммит 74a35628e2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -174,7 +174,7 @@ namespace Microsoft.ApplicationInspector.Commands
/// List of detected programming languages used and count of files
/// </summary>
[JsonProperty(PropertyName = "languages")]
public ConcurrentDictionary<string, int> Languages { get; set; } = new ConcurrentDictionary<string, int>();
public ImmutableSortedDictionary<string, int> Languages { get; set; } //unable to init here for constr arg
/// <summary>
/// List of detected tag counters i.e. metrics

Просмотреть файл

@ -31,6 +31,7 @@ namespace Microsoft.ApplicationInspector.Commands
private ConcurrentDictionary<string, byte> CloudTargets { get; set; } = new ConcurrentDictionary<string, byte>();
private ConcurrentDictionary<string, byte> OSTargets { get; set; } = new ConcurrentDictionary<string, byte>();
private ConcurrentDictionary<string,MetricTagCounter> TagCounters { get; set; } = new ConcurrentDictionary<string, MetricTagCounter>();
private ConcurrentDictionary<string, int> Languages { get; set; } = new ConcurrentDictionary<string, int>();
internal MetaData Metadata { get; set; }
@ -150,6 +151,7 @@ namespace Microsoft.ApplicationInspector.Commands
Metadata.FileExtensions = FileExtensions.ToImmutableSortedDictionary().Keys.ToList();
Metadata.Outputs = Outputs.ToImmutableSortedDictionary().Keys.ToList();
Metadata.Targets = Targets.ToImmutableSortedDictionary().Keys.ToList();
Metadata.Languages = Languages.ToImmutableSortedDictionary();
foreach (MetricTagCounter metricTagCounter in TagCounters.Values)
{
@ -163,7 +165,7 @@ namespace Microsoft.ApplicationInspector.Commands
/// <param name="language"></param>
public void AddLanguage(string language)
{
Metadata.Languages.AddOrUpdate(language, 1, (language, count) => count + 1);
Languages.AddOrUpdate(language, 1, (language, count) => count + 1);
}
#region helpers