<commit_before>using System.Collections.Generic;
using JetBrains.Annotations;
using JetBrains.DocumentManagers;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.ReSharper.Feature.Services.Intentions;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.PerformanceCriticalCodeAnalysis;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.PerformanceCriticalCodeAnalysis.Highlightings;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes.CallGraph.PerformanceAnalysis
{
    [QuickFix]
    public class PerformanceAnalysisDisableByCommentQuickFix : IQuickFix
    {
        [CanBeNull] private readonly IMethodDeclaration myMethodDeclaration;
        [CanBeNull] private readonly PerformanceAnalysisDisableByCommentBulbAction myBulbAction;

        public PerformanceAnalysisDisableByCommentQuickFix(UnityPerformanceCriticalCodeLineMarker performanceHighlighting)
        {
            var range = performanceHighlighting.CalculateRange();
            var document = range.Document;
            var solution = document.TryGetSolution();

            if (solution == null)
                return;
            
            var psiSourceFile = document.GetPsiSourceFile(solution);
            var file = psiSourceFile?.GetTheOnlyPsiFile(CSharpLanguage.Instance);
            
            if (file == null)
                return;
            
            var node = file.FindNodeAt(range) as ICSharpIdentifier;
            myMethodDeclaration = MethodDeclarationNavigator.GetByNameIdentifier(node);
            
            if (myMethodDeclaration != null)
                myBulbAction = new PerformanceAnalysisDisableByCommentBulbAction(myMethodDeclaration);
        }

        public IEnumerable<IntentionAction> CreateBulbItems()
        {
            if (myMethodDeclaration == null || myBulbAction == null)
                return EmptyList<IntentionAction>.Instance;

            return myBulbAction.ToQuickFixIntentions();
        }

        public bool IsAvailable(IUserDataHolder cache)
        {
            var methodDeclaration = myMethodDeclaration;
            
            // CGTD overlook. performance and validity
            if (methodDeclaration == null)
                return false;

            var declaredElement = methodDeclaration.DeclaredElement;

            return declaredElement != null && methodDeclaration.IsValid() &&<commit_msg>performance by comment QF fix<commit_after>using System.Collections.Generic;
using JetBrains.Annotations;
using JetBrains.DocumentManagers;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.ReSharper.Feature.Services.Intentions;
using JetBrains.ReSharper.Feature.Services.QuickFixes;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Errors;
using JetBrains.ReSharper.Plugins.Unity.CSharp.Daemon.Stages.PerformanceCriticalCodeAnalysis;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.CSharp;
using JetBrains.ReSharper.Psi.CSharp.Tree;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Unity.CSharp.Feature.Services.QuickFixes.CallGraph.PerformanceAnalysis
{
    [QuickFix]
    public class PerformanceAnalysisDisableByCommentQuickFix : IQuickFix
    {
        [CanBeNull] private readonly IMethodDeclaration myMethodDeclaration;
        [CanBeNull] private readonly PerformanceAnalysisDisableByCommentBulbAction myBulbAction;

        public PerformanceAnalysisDisableByCommentQuickFix(UnityPerformanceInvocationWarning performanceHighlighting)
        {
            var range = performanceHighlighting.CalculateRange();
            var document = range.Document;
            var solution = document.TryGetSolution();

            if (solution == null)
                return;
            
            var psiSourceFile = document.GetPsiSourceFile(solution);
            var file = psiSourceFile?.GetTheOnlyPsiFile(CSharpLanguage.Instance);
            
            if (file == null)
                return;
            
            var node = file.FindNodeAt(range);
            myMethodDeclaration = node?.GetContainingNode<IMethodDeclaration>();
            
            if (myMethodDeclaration != null)
                myBulbAction = new PerformanceAnalysisDisableByCommentBulbAction(myMethodDeclaration);
        }

        public IEnumerable<IntentionAction> CreateBulbItems()
        {
            if (myMethodDeclaration == null || myBulbAction == null)
                return EmptyList<IntentionAction>.Instance;

            return myBulbAction.ToQuickFixIntentions();
        }

        public bool IsAvailable(IUserDataHolder cache)
        {
            var methodDeclaration = myMethodDeclaration;
            
            // CGTD overlook. performance and validity
            if (methodDeclaration == null)
                return false;

            var declaredElement = methodDeclaration.DeclaredElement;

            return declaredElement != null && methodDeclaration.IsValid() &&
{'fraction_non_alphanumeric': 0.07064905226881103, 'fraction_numerical': 0.0, 'mean_word_length': 2.936699321778448, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '6895555', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1311, 'n_words': 238}