<commit_before>using JetBrains.Annotations;
using JetBrains.Application.UI.PopupLayout;
using JetBrains.Diagnostics;
using JetBrains.IDE;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.DeferredCaches.AnimatorUsages;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Pointers;
using JetBrains.UI.RichText;
using JetBrains.Util;
using JetBrains.Util.Extension;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Feature.Services.Navigation
{
    public class UnityAnimatorScriptOccurence : UnityAssetOccurrence
    {
        [NotNull] private IAnimatorScriptUsage Usage { get; }

        public UnityAnimatorScriptOccurence([NotNull] IPsiSourceFile sourceFile,
                                            [NotNull] IDeclaredElementPointer<IDeclaredElement> declaredElement,
                                            [NotNull] IAnimatorScriptUsage usage)
            : base(sourceFile, declaredElement, usage.Location, false)
        {
            Usage = usage;
        }

        public override RichText GetDisplayText()
        {
            var animatorContainer = GetSolution()
                .NotNull("occurrence.GetSolution() != null")
                .GetComponent<AnimatorScriptUsagesElementContainer>();
            var stateMachinePath = animatorContainer.GetStateMachinePathFor(Usage.Location);
            return stateMachinePath.IsEmpty() 
                ? new RichText($"{Usage.Name}") 
                : new RichText($"{stateMachinePath}/{Usage.Name}");
        }

        public override string GetRelatedFilePresentation()
        {
            var filePathWithoutExtension = SourceFile?.Name.SubstringBeforeLast(".");
            return filePathWithoutExtension?.SubstringAfterLast("/");
        }
        <commit_msg>clean up: use assertion instead of elvis operator<commit_after>using JetBrains.Annotations;
using JetBrains.Application.UI.PopupLayout;
using JetBrains.Diagnostics;
using JetBrains.IDE;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Plugins.Unity.Yaml.Psi.DeferredCaches.AnimatorUsages;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Pointers;
using JetBrains.UI.RichText;
using JetBrains.Util;
using JetBrains.Util.Extension;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Feature.Services.Navigation
{
    public class UnityAnimatorScriptOccurence : UnityAssetOccurrence
    {
        [NotNull] private IAnimatorScriptUsage Usage { get; }

        public UnityAnimatorScriptOccurence([NotNull] IPsiSourceFile sourceFile,
                                            [NotNull] IDeclaredElementPointer<IDeclaredElement> declaredElement,
                                            [NotNull] IAnimatorScriptUsage usage)
            : base(sourceFile, declaredElement, usage.Location, false)
        {
            Usage = usage;
        }

        public override RichText GetDisplayText()
        {
            var animatorContainer = GetSolution()
                .NotNull("occurrence.GetSolution() != null")
                .GetComponent<AnimatorScriptUsagesElementContainer>();
            var stateMachinePath = animatorContainer.GetStateMachinePathFor(Usage.Location);
            return stateMachinePath.IsEmpty() 
                ? new RichText($"{Usage.Name}") 
                : new RichText($"{stateMachinePath}/{Usage.Name}");
        }

        public override string GetRelatedFilePresentation()
        {
            return SourceFile.NotNull().Name.SubstringBeforeLast(".")?.SubstringAfterLast("/");
        }
        
{'fraction_non_alphanumeric': 0.08620689655172414, 'fraction_numerical': 0.0, 'mean_word_length': 2.713536201469045, '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': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5940955', 'n_tokens_mistral': 951, 'n_tokens_neox': 912, 'n_words': 158}