<commit_before>using System;
using System.Linq;

namespace Glimpse.Core.Plugin.Assist
{
	public static class TabRowFormattingExtensions
	{
		public static TabRow Bold(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Bold);
		}

		public static TabRow BoldIf(this TabRow row, bool condition)
		{
			return condition ? row.Bold() : row;
		}

		public static TabRow Italic(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Italic);
		}

		public static TabRow ItalicIf(this TabRow row, bool condition)
		{
			return condition ? row.Italic() : row;
		}

		public static TabRow Raw(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Raw);
		}

		public static TabRow RawIf(this TabRow row, bool condition)
		{
			return condition ? row.Raw() : row;
		}

		public static TabRow Sub(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Sub);
		}

		public static TabRow SubIf(this TabRow row, bool condition)
		{
			return condition ? row.Sub() : row;
		}

		public static TabRow Underline(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Underline);
		}

		public static TabRow UnderlineIf(this TabRow row, bool condition)
		{
			return condition ? row.Underline() : row;
		}


		public static TabRow Error(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Error);
		}

		public static TabRow ErrorIf(this TabRow row, bool condition)
		{
			return condition ? row.Error() : row;
		}

		public static TabRow Fail(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Fail);
		}

		public static TabRow FailIf(this TabRow row, bool condition)
		{
			return condition ? row.Fail() : row;
		}

		public static TabRow Info(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Info);
		}

		public static TabRow InfoIf(this TabRow row, bool condition)
		{
			return condition ? row.Info() : row;
		}

		public static TabRow Loading(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Loading);
		}

		public static TabRow LoadingIf(this TabRow row, bool condition)
		{
			return condition ? row.Loading() : row;
		}

		public static TabRow Ms(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Ms);
		}

		public static TabRow MsIf(this TabRow row, bool condition)
		{
			return condition ? row.Ms() : row;
		}

		public static TabRow Quiet(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Quiet);
		}

		public static TabRow QuietIf(this TabRow row, bool condition)
		{
			return condition ? row.Quiet() : row;
		}

		public static TabRow Selected(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Selected);
		}

		public static TabRow SelectedIf(this TabRow row, bool condition)
		{
			return condition ? row.Selected() : row;
		}
		
		public static TabRow Warn(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Warn);
		}

		public static TabRow WarnIf(this TabRow row, bool condition)
		{
			return condition ? row.Warn() : row;
		}


		private static TabRow VerifyAndApplyFormatting(TabRow row, string operation)
		{
			if (row.Columns.Count() <= 0)
				throw new InvalidOperationException(String.Format("The operation '{0}' is only valid when row has columns.", operation));
<commit_msg>- Using Columns.Any() in VerifyAndApplyFormatting (TabRowFormattingExtensions).<commit_after>using System;
using System.Linq;

namespace Glimpse.Core.Plugin.Assist
{
	public static class TabRowFormattingExtensions
	{
		public static TabRow Bold(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Bold);
		}

		public static TabRow BoldIf(this TabRow row, bool condition)
		{
			return condition ? row.Bold() : row;
		}

		public static TabRow Italic(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Italic);
		}

		public static TabRow ItalicIf(this TabRow row, bool condition)
		{
			return condition ? row.Italic() : row;
		}

		public static TabRow Raw(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Raw);
		}

		public static TabRow RawIf(this TabRow row, bool condition)
		{
			return condition ? row.Raw() : row;
		}

		public static TabRow Sub(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Sub);
		}

		public static TabRow SubIf(this TabRow row, bool condition)
		{
			return condition ? row.Sub() : row;
		}

		public static TabRow Underline(this TabRow row)
		{
			return ApplyToLastColumn(row, Formats.Underline);
		}

		public static TabRow UnderlineIf(this TabRow row, bool condition)
		{
			return condition ? row.Underline() : row;
		}


		public static TabRow Error(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Error);
		}

		public static TabRow ErrorIf(this TabRow row, bool condition)
		{
			return condition ? row.Error() : row;
		}

		public static TabRow Fail(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Fail);
		}

		public static TabRow FailIf(this TabRow row, bool condition)
		{
			return condition ? row.Fail() : row;
		}

		public static TabRow Info(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Info);
		}

		public static TabRow InfoIf(this TabRow row, bool condition)
		{
			return condition ? row.Info() : row;
		}

		public static TabRow Loading(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Loading);
		}

		public static TabRow LoadingIf(this TabRow row, bool condition)
		{
			return condition ? row.Loading() : row;
		}

		public static TabRow Ms(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Ms);
		}

		public static TabRow MsIf(this TabRow row, bool condition)
		{
			return condition ? row.Ms() : row;
		}

		public static TabRow Quiet(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Quiet);
		}

		public static TabRow QuietIf(this TabRow row, bool condition)
		{
			return condition ? row.Quiet() : row;
		}

		public static TabRow Selected(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Selected);
		}

		public static TabRow SelectedIf(this TabRow row, bool condition)
		{
			return condition ? row.Selected() : row;
		}
		
		public static TabRow Warn(this TabRow row)
		{
			return VerifyAndApplyFormatting(row, FormattingKeywords.Warn);
		}

		public static TabRow WarnIf(this TabRow row, bool condition)
		{
			return condition ? row.Warn() : row;
		}


		private static TabRow VerifyAndApplyFormatting(TabRow row, string operation)
		{
			if (!row.Columns.Any())
				throw new InvalidOperationException(String.Format("The operation '{0}' is only valid when row has columns.", operation));

{'fraction_non_alphanumeric': 0.08820935019112026, 'fraction_numerical': 0.0004410467509556013, 'mean_word_length': 3.8351101634683724, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '3834139', 'n_tokens_mistral': 2458, 'n_tokens_neox': 2144, 'n_words': 616}