<commit_before>﻿using System;
using System.Linq;
using SoftwareThresher.Utilities;
using Console = SoftwareThresher.Utilities.Console;

namespace SoftwareThresher.Configurations {
   public class UsageReport {
      readonly IConsole console;
      readonly IClassFinder classFinder;

      public UsageReport() : this(new ClassFinder(), new Console()) { }

      public UsageReport(IClassFinder classFinder, IConsole console)
      {
         this.console = console;
         this.classFinder = classFinder;
      }

      // TODO - Add settings 
      public void Write() {
         console.WriteLine("Usage: SoftwareThresher.exe config.xml [config.xml]");

         foreach (var task in classFinder.TaskTypes) {
            var parameters = task.GetConstructors().Single().GetParameters();
            var parameterText = string.Join(", ", parameters.Select(p => p.ParameterType.Name));
            console.WriteLine($"\tTask:\t{task.Name}({parameterText})");

            var properties = task.GetProperties().Where(a => a.CanWrite);
            foreach (var property in properties) {
               var noteAttribute = (UsageNoteAttribute)Attribute.GetCustomAttributes(property).FirstOrDefault(a => a.GetType() == typeof(UsageNoteAttribute));
               var noteText = noteAttribute != null ? " - " + noteAttribute.Note : string.Empty;

               console.WriteLine($"\t\tAttribute:\t{property.Name} ({property.PropertyType.Name}){noteText}");
            }
         }
      }
   }
}<commit_msg>Clean Up UsageReport a bit<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using SoftwareThresher.Utilities;
using Console = SoftwareThresher.Utilities.Console;

namespace SoftwareThresher.Configurations {
   public class UsageReport {
      readonly IConsole console;
      readonly IClassFinder classFinder;

      public UsageReport() : this(new ClassFinder(), new Console()) { }

      public UsageReport(IClassFinder classFinder, IConsole console)
      {
         this.console = console;
         this.classFinder = classFinder;
      }

      // TODO - Add settings 
      public void Write() {
         console.WriteLine("Usage: SoftwareThresher.exe config.xml [config.xml]");

         foreach (var task in classFinder.TaskTypes) {
            console.WriteLine($"\tTask:\t{task.Name}({GetParameterText(task)})");

            foreach (var property in GetProperties(task)) {
               WriteProperty(property);
            }
         }
      }

      static string GetParameterText(Type task)
      {
         var parameters = task.GetConstructors().Single().GetParameters();
         return string.Join(", ", parameters.Select(p => p.ParameterType.Name));
      }

      static IEnumerable<PropertyInfo> GetProperties(Type task) {
         return task.GetProperties().Where(a => a.CanWrite);
      }

      void WriteProperty(PropertyInfo property) {
         var noteAttribute = (UsageNoteAttribute) Attribute.GetCustomAttributes(property).FirstOrDefault(a => a.GetType() == typeof(UsageNoteAttribute));
         var noteText = noteAttribute != null ? " - " + noteAttribute.Note : string.Empty;

         console.WriteLine($"\t\tAttribute:\t{property.Name} ({property.PropertyType.Name}){noteText}");
      }
   }
}
{'fraction_non_alphanumeric': 0.11589805825242719, 'fraction_numerical': 0.0, 'mean_word_length': 2.9343675417661097, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6816883', 'n_tokens_mistral': 863, 'n_tokens_neox': 856, 'n_words': 181}