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

Fix regex patterns for Forge and mod version validation #99

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Analysis/Problem/Forge/ModDependencyProblem.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public static function getPatterns(): array
{
return [
'/The mod \S+ \(([^\)]+)\) requires mods \[([^\]]+)\] to be available/',
'/net\.minecraftforge\.fml\.common\.MissingModsException: Mod \S+ \((.+)\) requires (.+)/',
'/net\.minecraftforge\.fml\.ModLoadingException: Mod \§.([^\§]+)\§. requires \§.([^\§]+)\§. \§.([^ \§]+)[^\§]*\§./',
'/net\.minecraftforge\.fml\.LoadingFailedException: Loading errors encountered: \[\n(?:.*\n)*Mod \§.([^\§]+)§. requires \§.([^\§]+)\§. \§.([^ \§]+)[^\§]*\§./'
'/net\.minecraftforge\.fml\.common\.MissingModsException: Mod \S+ \((.+)\) requires (?!minecraft[,\s])(.+)/',
'/net\.minecraftforge\.fml\.ModLoadingException: Mod \§.([^\§]+)\§. requires \§.(?!minecraft\§.)([^\§]+)\§. \§.([^ \§]+)[^\§]*\§./',
'/net\.minecraftforge\.fml\.LoadingFailedException: Loading errors encountered: \[\n(?:.*\n)*Mod \§.([^\§]+)§. requires \§.(?!minecraft\§.)([^\§]+)\§. \§.([^ \§]+)[^\§]*\§./'
Copy link
Member

Choose a reason for hiding this comment

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

You are changing 3 patterns here, but only adding one to the Minecraft version problem.

];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ public function getMessage(): string
*/
public static function getPatterns(): array
{
return ['/The mod (\S+) does not wish to run in Minecraft version Minecraft ([0-9\.]+)\. You will have to remove it to play\./'];
return [
'/The mod (\S+) does not wish to run in Minecraft version Minecraft ([0-9\.]+)\. You will have to remove it to play\./',
'/net\.minecraftforge\.fml\.ModLoadingException: Mod \§.([^\§]+)\§. requires \§.minecraft\§. \§.([^ \§]+)[^\§]*\§./',
];
}

/**
Expand Down
9 changes: 6 additions & 3 deletions test/data/Vanilla/Forge/forge-mod-loading-dependency.json
Original file line number Diff line number Diff line change
Expand Up @@ -1773,8 +1773,8 @@
]
},
{
"message": "The mod 'car' is missing the required mod 'minecraft'.",
"counter": 2,
"message": "The mod 'car' is not compatible with the Minecraft version 1.15.1.",
Copy link
Member

Choose a reason for hiding this comment

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

You should add a new log for the non-Minecraft test case.

"counter": 1,
"entry": {
"level": 2,
"time": null,
Expand Down Expand Up @@ -1884,7 +1884,10 @@
},
"solutions": [
{
"message": "Install the mod 'minecraft' with version 1.15.1."
"message": "Remove the mod 'car'."
},
{
"message": "Install a different Forge version."
}
]
}
Expand Down
Loading
Loading