<commit_before>﻿using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Linq;
using System;

namespace CodeCracker
{
    [DiagnosticAnalyzer(LanguageNames.CSharp)]
    public class ParameterRefactoryAnalyzer : DiagnosticAnalyzer
    {
        public const string DiagnosticId = "CC0020";
        internal const string Title = "You should using 'new class'";
        internal const string MessageFormat = "When the method has more than three parameters, use new Class.";
        internal const string Category = "Syntax";

        internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);

        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }

        public override void Initialize(AnalysisContext context)
        {
            context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.MethodDeclaration);
        }

        private void AnalyzeNode(SyntaxNodeAnalysisContext context)
        {
            var method = (MethodDeclarationSyntax)context.Node;

            var contentParameter = method.ParameterList;

            if (!contentParameter.Parameters.Any() || contentParameter.Parameters.Count <= 3) return;

            if (method.Body.ChildNodes().Count() > 0) return;

            var diagnostic = Diagnostic.Create(Rule, contentParameter.GetLocation(), "You can use new Class instead of for.");

            context.ReportDiagnostic(diagnostic);
        }
    }
}<commit_msg>Update text diagnostic<commit_after>﻿using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Diagnostics;
using System.Collections.Immutable;
using System.Linq;
using System;

namespace CodeCracker
{
    [DiagnosticAnalyzer(LanguageNames.CSharp)]
    public class ParameterRefactoryAnalyzer : DiagnosticAnalyzer
    {
        public const string DiagnosticId = "CC0020";
        internal const string Title = "You should using 'new class'";
        internal const string MessageFormat = "When the method has more than three parameters, use new class.";
        internal const string Category = "Syntax";

        internal static DiagnosticDescriptor Rule = new DiagnosticDescriptor(DiagnosticId, Title, MessageFormat, Category, DiagnosticSeverity.Warning, isEnabledByDefault: true);

        public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics { get { return ImmutableArray.Create(Rule); } }

        public override void Initialize(AnalysisContext context)
        {
            context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.MethodDeclaration);
        }

        private void AnalyzeNode(SyntaxNodeAnalysisContext context)
        {
            var method = (MethodDeclarationSyntax)context.Node;

            var contentParameter = method.ParameterList;

            if (!contentParameter.Parameters.Any() || contentParameter.Parameters.Count <= 3) return;

            if (method.Body.ChildNodes().Count() > 0) return;

            var diagnostic = Diagnostic.Create(Rule, contentParameter.GetLocation());

            context.ReportDiagnostic(diagnostic);
        }
    }
}
{'fraction_non_alphanumeric': 0.07890122735242548, 'fraction_numerical': 0.0035067212156633548, 'mean_word_length': 3.638211382113821, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3831593', 'n_tokens_mistral': 831, 'n_tokens_neox': 787, 'n_words': 220}