<commit_before>﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using Foundation.Build.VersionControl;
using Foundation.Build.VersionControl.Vault;
using Foundation.ExtensionMethods;
using Foundation.Windows;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace Foundation.Build.MSBuild
{
    public class IndexSymbolSources : Task
    {
        /// <summary>
        /// When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the task successfully executed; otherwise, <c>false</c>.
        /// </returns>
        public override bool Execute()
        {
            // Get the version control arguments, which are in the form of a URI
            var uri = new Uri(VersionControlArguments);

            var vaultExecutable = VcsExecutablePath;

            var args = VersionControlArgumentsConverter.FromUri(uri);
            
            foreach (var item in Symbols)
            {
                var path = item.GetMetadata("FullPath");

                Log.LogMessage("Indexing source in file: {0}", path);

                var srcTool = new SrcTool(path);

                // Obtain a list of source files to index
                var files = srcTool.GetSourceFiles();
                files.ForEach( file => Log.LogMessage(MessageImportance.Low, "Source file: {0}", file) );
<commit_msg>If nothing is passed to the IndexSymbolSources MSBuild task, generate a warning and return success.<commit_after>﻿using System;
using System.IO;
using System.Linq;
using System.Text;
using Foundation.Build.VersionControl;
using Foundation.Build.VersionControl.Vault;
using Foundation.ExtensionMethods;
using Foundation.Windows;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;

namespace Foundation.Build.MSBuild
{
    public class IndexSymbolSources : Task
    {
        /// <summary>
        /// When overridden in a derived class, executes the task.
        /// </summary>
        /// <returns>
        /// <c>true</c> if the task successfully executed; otherwise, <c>false</c>.
        /// </returns>
        public override bool Execute()
        {
            // Get the version control arguments, which are in the form of a URI
            var uri = new Uri(VersionControlArguments);

            if( Symbols == null )
            {
                Log.LogWarning("No symbol files passed to index");
                return true;
            }

            var vaultExecutable = VcsExecutablePath;

            var args = VersionControlArgumentsConverter.FromUri(uri);
            
            foreach (var item in Symbols)
            {
                var path = item.GetMetadata("FullPath");

                Log.LogMessage("Indexing source in file: {0}", path);

                var srcTool = new SrcTool(path);

                // Obtain a list of source files to index
                var files = srcTool.GetSourceFiles();
                files.ForEach( file => Log.LogMessage(MessageImportance.Low, "Source file: {0}", file) );

{'fraction_non_alphanumeric': 0.09671116900032563, 'fraction_numerical': 0.0013025073266037122, 'mean_word_length': 2.1251271617497456, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '4326974', 'n_tokens_mistral': 782, 'n_tokens_neox': 756, 'n_words': 245}