<commit_before>namespace Boxed.DotnetNewTest
{
    using System;
    using System.IO;
    using System.Linq;
    using System.Net.Http;
    using System.Net.Security;
    using System.Net.Sockets;
    using System.Security.Cryptography.X509Certificates;
    using System.Threading;
    using System.Threading.Tasks;
#if NETCOREAPP3_0
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.TestHost;
    using Microsoft.Extensions.Hosting;
#endif

    /// <summary>
    /// <see cref="Project"/> extension methods.
    /// </summary>
    public static class ProjectExtensions
    {
#if NETCOREAPP3_0
        private static readonly string[] DefaultUrls = new string[] { "http://localhost", "https://localhost" };
#endif

        /// <summary>
        /// Runs 'dotnet restore' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetRestoreAsync(
            this Project project,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        "restore",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet build' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="noRestore">Whether to restore the project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetBuildAsync(
            this Project project,
            bool? noRestore = true,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            var noRestoreArgument = noRestore is null ? null : "--no-restore";
            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        $"build {noRestoreArgument}",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet publish' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="framework">The framework.</param>
        /// <param name="runtime">The runtime.</param>
        /// <param name="noRestore">Whether to restore the project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns><commit_msg>Add dotnet tool restore, dotnet test and dotnet cake<commit_after>namespace Boxed.DotnetNewTest
{
    using System;
    using System.IO;
    using System.Linq;
    using System.Net.Http;
    using System.Net.Security;
    using System.Net.Sockets;
    using System.Security.Cryptography.X509Certificates;
    using System.Threading;
    using System.Threading.Tasks;
#if NETCOREAPP3_0
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.AspNetCore.TestHost;
    using Microsoft.Extensions.Hosting;
#endif

    /// <summary>
    /// <see cref="Project"/> extension methods.
    /// </summary>
    public static class ProjectExtensions
    {
#if NETCOREAPP3_0
        private static readonly string[] DefaultUrls = new string[] { "http://localhost", "https://localhost" };
#endif

        /// <summary>
        /// Runs 'dotnet restore' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetRestoreAsync(
            this Project project,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        "restore",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet build' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="noRestore">Whether to restore the project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetBuildAsync(
            this Project project,
            bool? noRestore = true,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            var noRestoreArgument = noRestore is null ? null : "--no-restore";
            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        $"build {noRestoreArgument}",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet test' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="noRestore">Whether to restore the project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetTestAsync(
            this Project project,
            bool? noRestore = true,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            var noRestoreArgument = noRestore is null ? null : "--no-restore";
            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        $"test {noRestoreArgument}",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet tool restore' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetToolRestoreAsync(
            this Project project,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        $"tool restore",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet cake' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="target">The target to run.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
        public static async Task DotnetCakeAsync(
            this Project project,
            string target = null,
            TimeSpan? timeout = null,
            bool showShellWindow = false)
        {
            if (project is null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            var targetArgument = target is null ? null : $"--target={target}";
            using (var cancellationTokenSource = new CancellationTokenSource(timeout ?? TimeSpan.FromMinutes(1)))
            {
                await AssertStartAsync(
                        project.DirectoryPath,
                        "dotnet",
                        $"cake {targetArgument}",
                        showShellWindow,
                        cancellationTokenSource.Token)
                    .ConfigureAwait(false);
            }
        }

        /// <summary>
        /// Runs 'dotnet publish' on the specified project.
        /// </summary>
        /// <param name="project">The project.</param>
        /// <param name="framework">The framework.</param>
        /// <param name="runtime">The runtime.</param>
        /// <param name="noRestore">Whether to restore the project.</param>
        /// <param name="timeout">The timeout. Defaults to one minute.</param>
        /// <param name="showShellWindow">if set to <c>true</c> show the shell window instead of logging to output.</param>
        /// <returns>A task representing the operation.</returns>
{'fraction_non_alphanumeric': 0.10805799055967633, 'fraction_numerical': 0.0017700606877950101, 'mean_word_length': 1.6953657428441617, 'pattern_counts': {'":': 0, '<': 137, '<?xml version=': 0, '>': 137, 'https://': 2, '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': '4661518', 'n_tokens_mistral': 2850, 'n_tokens_neox': 2804, 'n_words': 789}