From c9e78dc8584e935fc2bb3a6b21c702234550010f Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 14:50:56 -0500 Subject: [PATCH 01/10] updates: reorganizes error codes into logical groupings --- .../BepinExMultipleLoadsCheck.cs | 2 +- .../ContentChecks/BepinExVersionCheck.cs | 2 +- .../ContentChecks/ExceptionMatcherCheck.cs | 2 +- .../ContentChecks/NullRefMatcherCheck.cs | 2 +- .../ContentChecks/SharingViolationCheck.cs | 2 +- src/LogMuncher/RuleDatabase/Rules-List.cs | 25 +++++++++++++------ 6 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs index 140017d..32b61d7 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs @@ -8,7 +8,7 @@ internal class BepinExMultipleLoadsCheck(string Target) : BaseViolationCheck(Tar { private readonly static Violation SpecificViolation = new( new("""skipping.*version exists""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2002 + 2001 ); public override string CheckID => "BepinEx Multiple Loads"; diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs index d61fca4..2748553 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs @@ -8,7 +8,7 @@ internal class BepinExVersionCheck(string Target) : BaseViolationCheck(Target, S { private readonly static Violation SpecificViolation = new( new("""bepinex \(.+\) and might not work""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 1000 + 0000 ); public override string CheckID => "BepinEx Version"; diff --git a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs index 1cdf292..67f6f68 100644 --- a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs @@ -8,7 +8,7 @@ internal class ExceptionMatcherCheck(string Target) : BaseViolationCheck(Target, { private readonly static Violation SpecificViolation = new( new("""[\s\w]*Exception""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2000 + 4000 ); public override string CheckID => "Exception Matcher"; diff --git a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs index 31a3493..7e83a55 100644 --- a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs @@ -8,7 +8,7 @@ internal class NullRefMatcherCheck(string Target) : BaseViolationCheck(Target, S { private readonly static Violation SpecificViolation = new( new("""Object reference not set.*object""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2001 + 2000 ); public override string CheckID => "NullRef Matcher"; diff --git a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs index 0a82c94..0cdde6c 100644 --- a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs @@ -8,7 +8,7 @@ internal class SharingViolationCheck(string Target) : BaseViolationCheck(Target, { private readonly static Violation SpecificViolation = new( new("""sharing violation""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2003 + 2002 ); public override string CheckID => "Sharing Violation"; diff --git a/src/LogMuncher/RuleDatabase/Rules-List.cs b/src/LogMuncher/RuleDatabase/Rules-List.cs index 8f00f7a..cd2cdca 100644 --- a/src/LogMuncher/RuleDatabase/Rules-List.cs +++ b/src/LogMuncher/RuleDatabase/Rules-List.cs @@ -6,25 +6,36 @@ internal static partial class Rules { public static void Init() { - RuleList.Add(1000, + + //Ignorable non-issues 0000s + + RuleList.Add(0000, new(-15f, Muncher.CircumstanceType.Additive, "This warning is completely safe to ignore") ); - RuleList.Add(2000, - new(15f, Muncher.CircumstanceType.Additive, "Expression contains an Exception") - ); + //Slight Issues 1000s - RuleList.Add(2001, + //Moderate Errors 2000s + + RuleList.Add(2000, new(4f, Muncher.CircumstanceType.Additive, "Expression contains a null reference") ); //BepinEx same plugin multiple times - RuleList.Add(2002, + RuleList.Add(2001, new(5f, Muncher.CircumstanceType.Additive, "BepinEx is skipping a plugin because it already loaded it once") ); - RuleList.Add(2003, + RuleList.Add(2002, new(5f, Muncher.CircumstanceType.Additive, "A file failed to load") ); + + //Serious errors 3000s + + //Critical errors 4000s + + RuleList.Add(4000, + new(15f, Muncher.CircumstanceType.Additive, "Expression contains an Exception") + ); } } From 70e7f78009338ab77e5519c9292965c7f7f35283 Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 14:56:28 -0500 Subject: [PATCH 02/10] updates: adds better description to 2002 --- src/LogMuncher/RuleDatabase/Rules-List.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LogMuncher/RuleDatabase/Rules-List.cs b/src/LogMuncher/RuleDatabase/Rules-List.cs index cd2cdca..4ab4a36 100644 --- a/src/LogMuncher/RuleDatabase/Rules-List.cs +++ b/src/LogMuncher/RuleDatabase/Rules-List.cs @@ -27,7 +27,7 @@ public static void Init() ); RuleList.Add(2002, - new(5f, Muncher.CircumstanceType.Additive, "A file failed to load") + new(5f, Muncher.CircumstanceType.Additive, "A file failed to load due to a sharing violation") ); //Serious errors 3000s From 8a08a45fec7e75d24ee620aad05400dc0c3e1055 Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 14:59:28 -0500 Subject: [PATCH 03/10] adds: formatter to code output --- src/LogMuncher/Muncher/LineData.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/LogMuncher/Muncher/LineData.cs b/src/LogMuncher/Muncher/LineData.cs index a214b31..b2f5463 100644 --- a/src/LogMuncher/Muncher/LineData.cs +++ b/src/LogMuncher/Muncher/LineData.cs @@ -4,8 +4,6 @@ using LogMuncher.RuleDatabase; using LogMuncher.CheckRunners; using dev.mamallama.checkrunnerlib.CheckRunners; -using System.Net; -using System; namespace LogMuncher.Muncher; @@ -105,7 +103,7 @@ internal static void TraverseAndPrint(this ICheckRunner head, StringBuilder sb) //Output Violation Name sb.Append("- [LCM"); - sb.Append(check.MyViolation.ErrorCode); + sb.Append(check.MyViolation.ErrorCode.ToString("D4")); sb.Append("] "); sb.Append(rule.Description); sb.Append(" `"); From da764ce32f7f78a3b24d7d351f953a2396e9f30c Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 15:08:07 -0500 Subject: [PATCH 04/10] adds: output link to reference docs in each matched problem --- src/LogMuncher/Muncher/LineData.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/LogMuncher/Muncher/LineData.cs b/src/LogMuncher/Muncher/LineData.cs index b2f5463..b3eb836 100644 --- a/src/LogMuncher/Muncher/LineData.cs +++ b/src/LogMuncher/Muncher/LineData.cs @@ -100,11 +100,21 @@ internal static void TraverseAndPrint(this ICheckRunner head, StringBuilder sb) //cache the rule var rule = Rules.GetRuleById(check.MyViolation.ErrorCode); + const string MatcherAddress = "https://lethalcompanymodding.github.io/Thunderstore/Tools/Log-Muncher.html#lcm-"; - //Output Violation Name - sb.Append("- [LCM"); + //Output Violation Name and link + sb.Append("- "); + sb.Append(""""); + + sb.Append("[LCM"); sb.Append(check.MyViolation.ErrorCode.ToString("D4")); sb.Append("] "); + sb.Append(""""""); + + //Violation description sb.Append(rule.Description); sb.Append(" `"); sb.Append(rule.Type.GetStringDesc(rule.Value)); From 7e422229b0207cd008f31a5a52c29649acd0ba27 Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 15:14:34 -0500 Subject: [PATCH 05/10] updates: stop wrapping lines in output --- src/LogMuncher/Muncher/LogMuncher.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LogMuncher/Muncher/LogMuncher.cs b/src/LogMuncher/Muncher/LogMuncher.cs index b945a25..f5e0e97 100644 --- a/src/LogMuncher/Muncher/LogMuncher.cs +++ b/src/LogMuncher/Muncher/LogMuncher.cs @@ -77,7 +77,7 @@ public void MunchLog() //Read context until next line while (Input.Peek() != '[' && Input.Peek() != -1) { - line += Input.ReadLine()?.ReplaceLineEndings(""); + line += Input.ReadLine();//?.ReplaceLineEndings(""); addedLines++; } From 5c79ecc18b57d0abfc37a440e4c3e79bdd707d84 Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 15:40:43 -0500 Subject: [PATCH 06/10] removes: cleans up comments in logmuncher.cs --- src/LogMuncher/Muncher/LogMuncher.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/LogMuncher/Muncher/LogMuncher.cs b/src/LogMuncher/Muncher/LogMuncher.cs index f5e0e97..68db8d2 100644 --- a/src/LogMuncher/Muncher/LogMuncher.cs +++ b/src/LogMuncher/Muncher/LogMuncher.cs @@ -9,8 +9,6 @@ using System.Text; using Markdig; using LogMuncher.CheckRunners; -using LogMuncher.Checks; -using dev.mamallama.checkrunnerlib.Checks; namespace LogMuncher.Muncher; internal class TheLogMuncher(FileInfo Input, TextWriter Output) : IDisposable @@ -28,14 +26,6 @@ internal class TheLogMuncher(FileInfo Input, TextWriter Output) : IDisposable //For repeat log snipping protected readonly List AllErrorHashes = []; - //Todo List: - //Split this list into its own file - //Source: HarmonyX - //Output links to read more about a violation when printing - //assetbundleSystem.IO.FileNotFoundException - //Could not find * call in - //failed IL hook - protected static readonly Regex LineBreaker = new("""\[(debug|info|warning|message|fatal|error)\s*:([\s\w]+)\](.*)""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)); protected const float DefaultLogWeight = 0.1f; From 1cc527b24b4d55f0c7579794ea85c64463ced27f Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 15:40:57 -0500 Subject: [PATCH 07/10] updates: cspell dictionary --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 994385a..97c15fb 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,6 +4,7 @@ "bepin", "bepinex", "LCMXXXX", + "Ragdoll", "skipcq" ] } From 783d7e06d84ce09a63516275f37be1331aed36aa Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 15:43:58 -0500 Subject: [PATCH 08/10] removes: unused string from all checks --- src/LogMuncher/Checks/BaseViolationCheck.cs | 1 + .../Checks/ContentChecks/BepinExMultipleLoadsCheck.cs | 2 -- src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs | 2 -- src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs | 2 -- src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs | 2 -- src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs | 2 -- 6 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/LogMuncher/Checks/BaseViolationCheck.cs b/src/LogMuncher/Checks/BaseViolationCheck.cs index 387172a..b4cdf02 100644 --- a/src/LogMuncher/Checks/BaseViolationCheck.cs +++ b/src/LogMuncher/Checks/BaseViolationCheck.cs @@ -11,6 +11,7 @@ internal abstract class BaseViolationCheck(string Target, Violation MyViolation) public readonly Violation MyViolation = MyViolation; protected abstract CheckStatus ViolationLevel { get; } public override ICheckRunner[] MyChecks => []; + public override string CheckID => "Violation Check"; public sealed override void RunChecks() { diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs index 32b61d7..2dba360 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs @@ -10,7 +10,5 @@ internal class BepinExMultipleLoadsCheck(string Target) : BaseViolationCheck(Tar new("""skipping.*version exists""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), 2001 ); - - public override string CheckID => "BepinEx Multiple Loads"; protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs index 2748553..7a77a68 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs @@ -10,7 +10,5 @@ internal class BepinExVersionCheck(string Target) : BaseViolationCheck(Target, S new("""bepinex \(.+\) and might not work""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), 0000 ); - - public override string CheckID => "BepinEx Version"; protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs index 67f6f68..6176670 100644 --- a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs @@ -10,7 +10,5 @@ internal class ExceptionMatcherCheck(string Target) : BaseViolationCheck(Target, new("""[\s\w]*Exception""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), 4000 ); - - public override string CheckID => "Exception Matcher"; protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs index 7e83a55..d7e4a67 100644 --- a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs @@ -10,7 +10,5 @@ internal class NullRefMatcherCheck(string Target) : BaseViolationCheck(Target, S new("""Object reference not set.*object""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), 2000 ); - - public override string CheckID => "NullRef Matcher"; protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs index 0cdde6c..6e37ecb 100644 --- a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs @@ -10,7 +10,5 @@ internal class SharingViolationCheck(string Target) : BaseViolationCheck(Target, new("""sharing violation""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), 2002 ); - - public override string CheckID => "Sharing Violation"; protected override CheckStatus ViolationLevel => CheckStatus.Warning; } From df4dabea1688d0593797135a45f8386cbe218dc1 Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 16:31:05 -0500 Subject: [PATCH 09/10] updates: all the things --- .../CheckRunners/AllChecksRunner.cs | 3 +-- .../CheckRunners/RegexContentRunner.cs | 1 + .../CheckRunners/RegexSourceRunner.cs | 3 ++- .../BepinExMultipleLoadsCheck.cs | 2 +- .../ContentChecks/BepinExVersionCheck.cs | 2 +- .../ContentChecks/ExceptionMatcherCheck.cs | 2 +- .../ContentChecks/NullRefMatcherCheck.cs | 2 +- .../ContentChecks/PlayerRagdollCheck.cs | 15 +++++++++++++++ .../ContentChecks/SharingViolationCheck.cs | 2 +- .../Checks/SourceChecks/HarmonyCheck.cs | 15 +++++++++++++++ src/LogMuncher/Muncher/LineData.cs | 2 +- src/LogMuncher/RuleDatabase/Rules-List.cs | 19 +++++++++++++------ 12 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 src/LogMuncher/Checks/ContentChecks/PlayerRagdollCheck.cs create mode 100644 src/LogMuncher/Checks/SourceChecks/HarmonyCheck.cs diff --git a/src/LogMuncher/CheckRunners/AllChecksRunner.cs b/src/LogMuncher/CheckRunners/AllChecksRunner.cs index 0aded93..ab9c930 100644 --- a/src/LogMuncher/CheckRunners/AllChecksRunner.cs +++ b/src/LogMuncher/CheckRunners/AllChecksRunner.cs @@ -9,9 +9,8 @@ internal class AllChecksRunner(string Source, string Content, string Level) : Ba public override ICheckRunner[] MyChecks => checks; private readonly ICheckRunner[] checks = [ - //new RegexSourceRunner(Source), + new RegexSourceRunner(Source), new RegexContentRunner(Content), - //new RegexLevelRunner(Level), ]; } diff --git a/src/LogMuncher/CheckRunners/RegexContentRunner.cs b/src/LogMuncher/CheckRunners/RegexContentRunner.cs index aa43c3f..9defa8d 100644 --- a/src/LogMuncher/CheckRunners/RegexContentRunner.cs +++ b/src/LogMuncher/CheckRunners/RegexContentRunner.cs @@ -12,6 +12,7 @@ internal class RegexContentRunner(string Target) : BaseRegexCheckRunner(Target) new BepinExVersionCheck(Target), new ExceptionMatcherCheck(Target), new NullRefMatcherCheck(Target), + new PlayerRagdollCheck(Target), new SharingViolationCheck(Target), ]; } diff --git a/src/LogMuncher/CheckRunners/RegexSourceRunner.cs b/src/LogMuncher/CheckRunners/RegexSourceRunner.cs index 887ac6a..f83791b 100644 --- a/src/LogMuncher/CheckRunners/RegexSourceRunner.cs +++ b/src/LogMuncher/CheckRunners/RegexSourceRunner.cs @@ -1,5 +1,6 @@ using LogMuncher.Checks; using dev.mamallama.checkrunnerlib.CheckRunners; +using LogMuncher.Checks.ContentChecks; namespace LogMuncher.CheckRunners; @@ -9,6 +10,6 @@ internal class RegexSourceRunner(string Target) : BaseRegexCheckRunner(Target) public override ICheckRunner[] MyChecks => checks; private readonly ICheckRunner[] checks = [ - + new HarmonySourceCheck(Target), ]; } diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs index 2dba360..776f2f1 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExMultipleLoadsCheck.cs @@ -8,7 +8,7 @@ internal class BepinExMultipleLoadsCheck(string Target) : BaseViolationCheck(Tar { private readonly static Violation SpecificViolation = new( new("""skipping.*version exists""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2001 + 20001 ); protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs index 7a77a68..cbe0c2c 100644 --- a/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/BepinExVersionCheck.cs @@ -8,7 +8,7 @@ internal class BepinExVersionCheck(string Target) : BaseViolationCheck(Target, S { private readonly static Violation SpecificViolation = new( new("""bepinex \(.+\) and might not work""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 0000 + 00000 ); protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs index 6176670..84d2764 100644 --- a/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/ExceptionMatcherCheck.cs @@ -8,7 +8,7 @@ internal class ExceptionMatcherCheck(string Target) : BaseViolationCheck(Target, { private readonly static Violation SpecificViolation = new( new("""[\s\w]*Exception""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 4000 + 40000 ); protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs index d7e4a67..072cbbd 100644 --- a/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/NullRefMatcherCheck.cs @@ -8,7 +8,7 @@ internal class NullRefMatcherCheck(string Target) : BaseViolationCheck(Target, S { private readonly static Violation SpecificViolation = new( new("""Object reference not set.*object""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2000 + 20000 ); protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/ContentChecks/PlayerRagdollCheck.cs b/src/LogMuncher/Checks/ContentChecks/PlayerRagdollCheck.cs new file mode 100644 index 0000000..b484d92 --- /dev/null +++ b/src/LogMuncher/Checks/ContentChecks/PlayerRagdollCheck.cs @@ -0,0 +1,15 @@ +using dev.mamallama.checkrunnerlib.Checks; +using System.Text.RegularExpressions; +using LogMuncher.Muncher; + +namespace LogMuncher.Checks.ContentChecks; + +internal class PlayerRagdollCheck(string Target) : BaseViolationCheck(Target, SpecificViolation) +{ + private readonly static Violation SpecificViolation = new( + new("""tag\W PlayerRagdoll\d* .+defined""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), + 00001 + ); + + protected override CheckStatus ViolationLevel => CheckStatus.Warning; +} diff --git a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs index 6e37ecb..1951b0c 100644 --- a/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs +++ b/src/LogMuncher/Checks/ContentChecks/SharingViolationCheck.cs @@ -8,7 +8,7 @@ internal class SharingViolationCheck(string Target) : BaseViolationCheck(Target, { private readonly static Violation SpecificViolation = new( new("""sharing violation""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), - 2002 + 20002 ); protected override CheckStatus ViolationLevel => CheckStatus.Warning; } diff --git a/src/LogMuncher/Checks/SourceChecks/HarmonyCheck.cs b/src/LogMuncher/Checks/SourceChecks/HarmonyCheck.cs new file mode 100644 index 0000000..44c1ac2 --- /dev/null +++ b/src/LogMuncher/Checks/SourceChecks/HarmonyCheck.cs @@ -0,0 +1,15 @@ +using dev.mamallama.checkrunnerlib.Checks; +using System.Text.RegularExpressions; +using LogMuncher.Muncher; + +namespace LogMuncher.Checks.ContentChecks; + +internal class HarmonySourceCheck(string Target) : BaseViolationCheck(Target, SpecificViolation) +{ + private readonly static Violation SpecificViolation = new( + new("""harmonyX?""", RegexOptions.IgnoreCase | RegexOptions.Compiled, new(0, 0, 1)), + 35000 + ); + + protected override CheckStatus ViolationLevel => CheckStatus.Warning; +} diff --git a/src/LogMuncher/Muncher/LineData.cs b/src/LogMuncher/Muncher/LineData.cs index b3eb836..3b5b9a1 100644 --- a/src/LogMuncher/Muncher/LineData.cs +++ b/src/LogMuncher/Muncher/LineData.cs @@ -100,7 +100,7 @@ internal static void TraverseAndPrint(this ICheckRunner head, StringBuilder sb) //cache the rule var rule = Rules.GetRuleById(check.MyViolation.ErrorCode); - const string MatcherAddress = "https://lethalcompanymodding.github.io/Thunderstore/Tools/Log-Muncher.html#lcm-"; + const string MatcherAddress = "https://lethalcompanymodding.github.io/Thunderstore/www/Tools/Log-Muncher.html#lcm-"; //Output Violation Name and link sb.Append("- "); diff --git a/src/LogMuncher/RuleDatabase/Rules-List.cs b/src/LogMuncher/RuleDatabase/Rules-List.cs index 4ab4a36..80dd7e2 100644 --- a/src/LogMuncher/RuleDatabase/Rules-List.cs +++ b/src/LogMuncher/RuleDatabase/Rules-List.cs @@ -9,32 +9,39 @@ public static void Init() //Ignorable non-issues 0000s - RuleList.Add(0000, + RuleList.Add(00000, new(-15f, Muncher.CircumstanceType.Additive, "This warning is completely safe to ignore") ); + RuleList.Add(00001, + new(-15f, Muncher.CircumstanceType.Additive, "This error is completely safe to ignore") + ); + //Slight Issues 1000s //Moderate Errors 2000s - RuleList.Add(2000, + RuleList.Add(20000, new(4f, Muncher.CircumstanceType.Additive, "Expression contains a null reference") ); //BepinEx same plugin multiple times - RuleList.Add(2001, - new(5f, Muncher.CircumstanceType.Additive, "BepinEx is skipping a plugin because it already loaded it once") + RuleList.Add(20001, + new(6f, Muncher.CircumstanceType.Additive, "BepinEx is skipping a plugin because it already loaded it once") ); - RuleList.Add(2002, + RuleList.Add(20002, new(5f, Muncher.CircumstanceType.Additive, "A file failed to load due to a sharing violation") ); //Serious errors 3000s + RuleList.Add(35000, + new(10f, Muncher.CircumstanceType.Additive, "Expression originates from HarmonyX, this is usually a bad sign") + ); //Critical errors 4000s - RuleList.Add(4000, + RuleList.Add(40000, new(15f, Muncher.CircumstanceType.Additive, "Expression contains an Exception") ); } From c41d59459fd3a46e19bf08d52600683dba4d422f Mon Sep 17 00:00:00 2001 From: Robyn Date: Fri, 2 Aug 2024 16:35:15 -0500 Subject: [PATCH 10/10] adds: readme encutification --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cc0e08a..513c0bd 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # LogMuncher + Munches Bepinex logs and sorts them by perceived severity -## Features -Pretty much just that. Use --help or -h to spit out command line switches, etc. \ No newline at end of file +## Usage + +See the [Documentation](https://lethalcompanymodding.github.io/Thunderstore/www/Tools/Log-Muncher.html#usage-and-arguments)