-
Notifications
You must be signed in to change notification settings - Fork 31
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
Validate dependencies and incompatibilities #91
Validate dependencies and incompatibilities #91
Conversation
var intro_text = "A %s for the mod '%s' is invalid: " % [type, original_mod_id] | ||
|
||
# contains hyphen? | ||
if not check_mod_id.count("-") == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use the is_name_or_namespace_valid
func if you String.split("-")
here (and checked if the array length is exactly 2)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried this originally, but it wasn't nearly as helpful. Here's the error if I use is_name_or_namespace_valid
:
And here's the error message with the approach I've used:
The 1st error tells you something is wrong with either a name or a namespace, but gives no indication of where/how to fix the problem. You don't know if it's occurring in your own mod or a dependency of it, nor whether it's an issue with the mods own name, or a dependency, or an incompatibility.
Whereas the 2nd error tells you which mod has an issue, and exactly where the issue is.
Trying to use is_name_or_namespace_valid
initially is actually the reason I made my errors so explicitly helpful: When I was testing this I made a bunch of purposefully faulty manifests, but found that I had no idea which of them were incorrect.
Better to do as much as we can to help people fix issues like this IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, you are right. Then it might be a better idea to turn the log in is_name_or_namespace_valid
into an error and add the log fatal like you did here once it returns false. I think that avoids having two places for id validation and the logs are still as informative, right? And don't forget to check false and log fatal after the other uses of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe that would be better in a subsequent PR? I don't want to change anything beyond the scope of validating deps/incompats for this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to get it done with I suppose. Having two places for the same validation is not good though, that needs to change
…, and make the `type` arg optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's do the subsequent pr
Validates dependencies and incompatibilities, checking the following for any specified mod IDs:
-
Closes #23