<commit_before>using System;
using System.Collections.Generic;
using JetBrains.Util;
using Xunit;
using Xunit.Abstractions;

namespace XunitContrib.Runner.ReSharper.RemoteRunner
{
    public class DiagnosticMessages
    {
        private readonly DiagnosticsVisitor visitor;

        public DiagnosticMessages(TestAssemblyConfiguration xunitConfiguration)
        {
            visitor = new DiagnosticsVisitor(xunitConfiguration);
        }

        public IMessageSink Visitor { get { return visitor; } }
        public bool HasMessages { get { return visitor.Messages.Count > 0; } }

        public string Messages
        {
            get { return string.Join(Environment.NewLine, visitor.Messages.ToArray()); }
        }

        public void Report(RemoteTaskServer server)
        {
            if (HasMessages)
                server.ShowNotification("xUnit.net ReSharper runner reported diagnostic messages:", Messages);
        }

        private class DiagnosticsVisitor : TestMessageVisitor
        {
            private readonly bool enabled;

            public DiagnosticsVisitor(TestAssemblyConfiguration xunitConfiguration)
            {
                Messages = new List<string>();
                // TODO: Check to see if resharper wants to enable/disable logging - this will override what's in config
                enabled = xunitConfiguration.DiagnosticMessagesOrDefault;
            }

            protected override bool Visit(IDiagnosticMessage diagnosticMessage)
            {
                if (enabled && !string.IsNullOrEmpty(diagnosticMessage.Message))
                    Messages.Add(diagnosticMessage.Message);
                return base.Visit(diagnosticMessage);
            }
<commit_msg>Report diagnostics if runner is in internal debug<commit_after>using System;
using System.Collections.Generic;
using JetBrains.ReSharper.TaskRunnerFramework;
using JetBrains.Util;
using Xunit;
using Xunit.Abstractions;

namespace XunitContrib.Runner.ReSharper.RemoteRunner
{
    public class DiagnosticMessages
    {
        private readonly DiagnosticsVisitor visitor;

        public DiagnosticMessages(TestAssemblyConfiguration xunitConfiguration)
        {
            visitor = new DiagnosticsVisitor(xunitConfiguration);
        }

        public IMessageSink Visitor { get { return visitor; } }
        public bool HasMessages { get { return visitor.Messages.Count > 0; } }

        public string Messages
        {
            get { return string.Join(Environment.NewLine, visitor.Messages.ToArray()); }
        }

        public void Report(RemoteTaskServer server)
        {
            if (HasMessages)
                server.ShowNotification("xUnit.net ReSharper runner reported diagnostic messages:", Messages);
        }

        private class DiagnosticsVisitor : TestMessageVisitor
        {
            private readonly bool enabled;

            public DiagnosticsVisitor(TestAssemblyConfiguration xunitConfiguration)
            {
                Messages = new List<string>();
                enabled = xunitConfiguration.DiagnosticMessagesOrDefault || TaskExecutor.Configuration.IsInInternalDebug;
            }

            protected override bool Visit(IDiagnosticMessage diagnosticMessage)
            {
                if (enabled && !string.IsNullOrEmpty(diagnosticMessage.Message))
                    Messages.Add(diagnosticMessage.Message);
                return base.Visit(diagnosticMessage);
            }

{'fraction_non_alphanumeric': 0.06491633006347375, 'fraction_numerical': 0.0005770340450086555, 'mean_word_length': 2.399019607843137, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2128503', 'n_tokens_mistral': 808, 'n_tokens_neox': 774, 'n_words': 196}