Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert diagnostic messages into plain text #1075

Merged
merged 6 commits into from
Mar 18, 2024

Conversation

erri120
Copy link
Member

@erri120 erri120 commented Mar 18, 2024

This is the first step towards rendering diagnostics in the UI. Diagnostic messages can now be written as plain text with all their fields populated.

@erri120 erri120 added this to the v0.4 milestone Mar 18, 2024
@erri120 erri120 requested a review from a team March 18, 2024 11:16
@erri120 erri120 self-assigned this Mar 18, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2024

Codecov Report

Attention: Patch coverage is 41.33333% with 88 lines in your changes are missing coverage. Please review.

Project coverage is 54.97%. Comparing base (4f6caba) to head (08dc03a).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1075      +/-   ##
==========================================
- Coverage   55.06%   54.97%   -0.10%     
==========================================
  Files         660      667       +7     
  Lines       21954    22092     +138     
  Branches     1703     1710       +7     
==========================================
+ Hits        12090    12145      +55     
- Misses       9469     9548      +79     
- Partials      395      399       +4     
Flag Coverage Δ
Linux 54.32% <41.33%> (-0.09%) ⬇️
Windows 54.15% <41.33%> (-0.16%) ⬇️
clean_environment_tests 54.96% <41.33%> (-0.09%) ⬇️
macOS 53.78% <41.33%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/NexusMods.App.UI/Services.cs 98.70% <100.00%> (+0.07%) ⬆️
...bstractions.Games.Diagnostics/IDiagnosticWriter.cs 0.00% <0.00%> (ø)
...Abstractions.Games.Diagnostics/Values/NamedLink.cs 0.00% <0.00%> (ø)
...rdewValley/Emitters/DependencyDiagnosticEmitter.cs 0.00% <0.00%> (ø)
...ames.StardewValley/Emitters/MissingSMAPIEmitter.cs 0.00% <0.00%> (ø)
...cs/DiagnosticTemplateIncrementalSourceGenerator.cs 84.31% <96.29%> (+3.13%) ⬆️
...Games/NexusMods.Games.StardewValley/Diagnostics.cs 0.00% <0.00%> (ø)
...Mods.App.UI/DiagnosticSystem/NamedLinkFormatter.cs 0.00% <0.00%> (ø)
...p.UI/DiagnosticSystem/LoadoutReferenceFormatter.cs 0.00% <0.00%> (ø)
...s.App.UI/DiagnosticSystem/ModReferenceFormatter.cs 0.00% <0.00%> (ø)
... and 3 more

... and 3 files with indirect coverage changes

Copy link
Member

@Sewer56 Sewer56 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems good to me.

I only have one suggestion, the method GetOutput implies (by name) that it is a getter.

Even if specified in docs, most programmers don't expect something that sounds like a getter to mutate the state of the current item. It may be better to rename it to something like GetOutputAndReset or Finish/Finalize. Neither of these suggestions are particularly great, so name it whatever you feel like. It's just a hint.

As for the generated formatting logic, it could be sped up by using IndexOf which defaults to SIMD under the hood. That said, I expect the bracket matching to be in the range of 900MB/s, so I don't expect that to ever be a bottleneck. The SIMD version for reference I imagine is above 13GB/s. Either way, no issue there, it's probably already fast enough, but if you ever want to optimize it, that's where you wanna strike.

@erri120
Copy link
Member Author

erri120 commented Mar 18, 2024

I only have one suggestion, the method GetOutput implies (by name) that it is a getter.

Even if specified in docs, most programmers don't expect something that sounds like a getter to mutate the state of the current item. It may be better to rename it to something like GetOutputAndReset or Finish/Finalize. Neither of these suggestions are particularly great, so name it whatever you feel like. It's just a hint.

I was thinking about Finalize but that's already kinda used for destructor invocation. Steam has Flush and some Start/End methods, but those also don't really fit. Maybe instead of GetOutput, ToOutput would fit better.

@Sewer56
Copy link
Member

Sewer56 commented Mar 18, 2024

I'm down for ToOutput honestly.

@erri120 erri120 merged commit 7b88a4c into Nexus-Mods:main Mar 18, 2024
7 checks passed
@erri120 erri120 deleted the feat/diagnostic-text branch March 18, 2024 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants