<commit_before>﻿using System.IO;
using FlubuCore.Targeting;
using FlubuCore.Tasks.NetCore;

namespace FlubuCore.Tasks.Testing
{
    public static class TestTaksExtensions
    {
        public static ITarget UnitTest(this ITarget target, params string[] projects)
        {
            foreach (string project in projects)
            {
                target.AddTask(Dotnet.Test(project));
            }

            return target;
        }

        public static ITarget CoverageDotnet(this ITarget target, params string[] projects)
        {
            foreach (string project in projects)
            {
                target.AddTask(CoverageDotnet(project, null, null));
            }

            return target;
        }

        public static ITarget CoverageDotnet(this ITarget target, string projectPath, string output, params string[] excludeList)
        {
            target.AddTask(CoverageDotnet(projectPath, output, excludeList));
            return target;
        }

        public static OpenCoverTask CoverageDotnet(string projectPath, string output, params string[] excludeList)
        {
            if (string.IsNullOrEmpty(output))
            {
                output = $"{Path.GetFileNameWithoutExtension(projectPath)}cover.xml";
            }

            return new OpenCoverTask()
                .TestExecutableArgs($"test {projectPath}")
                .Output(output)
                .UseDotNet()
                .AddExclude(excludeList);
        }

        public static OpenCoverToCoberturaTask ConvertToCobertura(string input, string output)
        {
            return new OpenCoverToCoberturaTask(input, output);
        }

        public static ITarget ConvertToCobertura(this ITarget target, string input, string output)
        {
            target.AddTask(ConvertToCobertura(input, output));
            return target;<commit_msg>opencover include all namespaces by default<commit_after>﻿using System.IO;
using FlubuCore.Targeting;
using FlubuCore.Tasks.NetCore;

namespace FlubuCore.Tasks.Testing
{
    public static class TestTaksExtensions
    {
        public static ITarget UnitTest(this ITarget target, params string[] projects)
        {
            foreach (string project in projects)
            {
                target.AddTask(Dotnet.Test(project));
            }

            return target;
        }

        public static ITarget CoverageDotnet(this ITarget target, params string[] projects)
        {
            foreach (string project in projects)
            {
                target.AddTask(CoverageDotnet(project, null, null));
            }

            return target;
        }

        public static ITarget CoverageDotnet(this ITarget target, string projectPath, string output, params string[] excludeList)
        {
            target.AddTask(CoverageDotnet(projectPath, output, excludeList));
            return target;
        }

        public static OpenCoverTask CoverageDotnet(string projectPath, string output, params string[] excludeList)
        {
            if (string.IsNullOrEmpty(output))
            {
                output = $"{Path.GetFileNameWithoutExtension(projectPath)}cover.xml";
            }

            return new OpenCoverTask()
                .TestExecutableArgs($"test {projectPath}")
                .Output(output)
                .UseDotNet()
                .IncludeAll()
                .AddExclude(excludeList);
        }

        public static OpenCoverToCoberturaTask ConvertToCobertura(string input, string output)
        {
            return new OpenCoverToCoberturaTask(input, output);
        }

        public static ITarget ConvertToCobertura(this ITarget target, string input, string output)
        {
            target.AddTask(ConvertToCobertura(input, output));
            return target;
{'fraction_non_alphanumeric': 0.0743172268907563, 'fraction_numerical': 0.0, 'mean_word_length': 2.0182250396196513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5821687', 'n_tokens_mistral': 978, 'n_tokens_neox': 935, 'n_words': 231}