Mutagen-Modding / Mutagen.Bethesda.Analyzers

A project to diagnose and analyze the health of a mod or a load order
GNU General Public License v3.0
16 stars 5 forks source link

EditorID RecordAnalyzerResult decoration #123

Closed Noggog closed 1 month ago

Noggog commented 1 month ago

When RecordAnalyzerResults and formatting a topic, we might want to do this:

if (param.LinkCache.TryResolve<IRaceGetter>(race, out var r))
{
    result.AddTopic(RecordTopic.Create(
        armor,
        ArmorMissingRaceAddons.Format(r.EditorID),
        ....));
    }
}

We should instead allow the analyzer to avoid the TryResolve lookup, and just pass the race FormLink directly. The engine can do the lookup during its reporting phase, and decorate/add the EditorID internally

Elscrux commented 1 month ago

I included this in #121 with commit https://github.com/Mutagen-Modding/Mutagen.Bethesda.Analyzers/pull/121/commits/5dd5471e21c288fca80f464006178eef53383e2a. Not sure that's the most elegant way to do this as it currently requires a separate game environment to be created as there is no DI to get an existing game environment. Currently the only place where one is created is ContextualEngine. Would it make sense to share the environment and make it available via DI? Also let me know if you have any preferences on the naming of these classes.

Elscrux commented 1 month ago

It went a bit out of control, updated the stuff above and added a little something for lists of things as well because I found myself using string.Join(", ", list) all the time https://github.com/Mutagen-Modding/Mutagen.Bethesda.Analyzers/pull/121/commits/330341cc24cb3d4e41c5f7f01c03863bf2eb9ce6