RSNetAuditRunner.h
Click a line number to link it. Shift-click to select a range.
| 1 | // Copyright (c) 2026 Reignance Studios. MIT License, see LICENSE. |
| 2 | |
| 3 | #pragma once |
| 4 | |
| 5 | #include "CoreMinimal.h" |
| 6 | |
| 7 | class UBlueprint; |
| 8 | |
| 9 | enum class ERSAuditSeverity : uint8 |
| 10 | { |
| 11 | Info, |
| 12 | Warning, |
| 13 | Error |
| 14 | }; |
| 15 | |
| 16 | /** Which findings fail a CI run (commandlet exit code and JUnit failures). */ |
| 17 | enum class ERSAuditFailOn : uint8 |
| 18 | { |
| 19 | Error, |
| 20 | Warning, |
| 21 | None |
| 22 | }; |
| 23 | |
| 24 | /** One problem found by one check. */ |
| 25 | struct RSNETAUDIT_API FRSAuditFinding |
| 26 | { |
| 27 | /** Stable id, e.g. GA-03. Listed in the README. */ |
| 28 | FString CheckId; |
| 29 | ERSAuditSeverity Severity = ERSAuditSeverity::Info; |
| 30 | /** Class or asset path the finding is about. */ |
| 31 | FString Subject; |
| 32 | FString Message; |
| 33 | FString Fix; |
| 34 | /** Tutorial slug on reignancestudios.com that explains the fix. */ |
| 35 | FString Tutorial; |
| 36 | /** Matched a line in the ignore file. Suppressed findings are reported but never counted or failed. */ |
| 37 | bool bSuppressed = false; |
| 38 | FString SuppressReason; |
| 39 | }; |
| 40 | |
| 41 | /** A table of what the audit read, for the report's inventory section. */ |
| 42 | struct RSNETAUDIT_API FRSAuditTable |
| 43 | { |
| 44 | FString Title; |
| 45 | TArray<FString> Columns; |
| 46 | TArray<TArray<FString>> Rows; |
| 47 | }; |
| 48 | |
| 49 | struct RSNETAUDIT_API FRSAuditOptions |
| 50 | { |
| 51 | /** Also scan engine and marketplace classes. Off by default: you cannot fix those. */ |
| 52 | bool bIncludeEngineClasses = false; |
| 53 | /** PlayerStates that hold an ASC below this rate get a warning. Lyra uses 100. */ |
| 54 | float MinPlayerStateNetUpdateFrequency = 30.f; |
| 55 | /** Bytes per second per client below which NET-01 warns. */ |
| 56 | int32 MinClientRate = 30000; |
| 57 | /** Severity that counts as failing in the JUnit report and the commandlet exit code. */ |
| 58 | ERSAuditFailOn FailOn = ERSAuditFailOn::Error; |
| 59 | /** Empty = <Project>/Config/RSNetAudit.ignore. */ |
| 60 | FString IgnoreFile; |
| 61 | /** Empty = <Project>/Saved/RSNetAudit. */ |
| 62 | FString OutputDir; |
| 63 | }; |
| 64 | |
| 65 | struct RSNETAUDIT_API FRSAuditResult |
| 66 | { |
| 67 | TArray<FRSAuditFinding> Findings; |
| 68 | TArray<FRSAuditTable> Inventory; |
| 69 | |
| 70 | int32 AbilitiesScanned = 0; |
| 71 | int32 AbilityBlueprintsScanned = 0; |
| 72 | int32 PlayerStatesScanned = 0; |
| 73 | int32 AttributeSetsScanned = 0; |
| 74 | |
| 75 | FString IgnoreFile; |
| 76 | FString MarkdownPath; |
| 77 | FString HtmlPath; |
| 78 | FString JsonPath; |
| 79 | FString JUnitPath; |
| 80 | |
| 81 | /** Findings of this severity, not counting suppressed ones. */ |
| 82 | int32 Count(ERSAuditSeverity Severity) const; |
| 83 | int32 SuppressedCount() const; |
| 84 | bool IsFailing(const FRSAuditFinding& Finding, ERSAuditFailOn FailOn) const; |
| 85 | int32 FailingCount(ERSAuditFailOn FailOn) const; |
| 86 | }; |
| 87 | |
| 88 | /** |
| 89 | * Runs every check and writes the report. Editor only: it loads Blueprint |
| 90 | * classes and reads their graphs. Safe to run from the commandlet, the |
| 91 | * Tools menu or the RSNetAudit.Run console command. |
| 92 | */ |
| 93 | class RSNETAUDIT_API FRSNetAuditRunner |
| 94 | { |
| 95 | public: |
| 96 | static FRSAuditResult Run(const FRSAuditOptions& Options); |
| 97 | |
| 98 | /** The Blueprint graph check (GA-05) on one ability Blueprint. Run calls it for every ability; tests call it directly. */ |
| 99 | static TArray<FRSAuditFinding> CheckAbilityGraphs(const UBlueprint* Blueprint); |
| 100 | }; |