-
Notifications
You must be signed in to change notification settings - Fork 145
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
Some validation messages for manifest syntax errors could be more accurate #3909
Comments
I personally think the messages are good enough, it is "standard JSON error"-like. @rpl WDYT? |
@willdurand I agree on the first two, I expect the extension developers to be able to find where the error pretty quickly based on the JSON_INVALID error reported to them. But we should fix the last one (
(@AlexandraMoga would you mind to collect the stack trace of the exception being raised, as in the code block right above, for the scenario that triggered one during a QA verification? that would highlight these unexpected conditions, and make them more visible in the middle of the ones reported with an actual linting error, and to get an idea of which condition did trigger the unexpected exception). I think we should be able to prevent this exception by just adding an additional check and early return in diff --git a/src/utils.js b/src/utils.js
index 219c35bd..d47dbd41 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -400,6 +400,9 @@ export function firefoxStrictMinVersion(manifestJson) {
manifestJson.applications.gecko &&
manifestJson.applications.gecko.strict_min_version
) {
+ if (typeof manifestJson.applications.gecko.strict_min_version !== "string") {
+ return null;
+ }
return parseInt(
manifestJson.applications.gecko.strict_min_version.split('.')[0],
10 |
@rpl this is the full stack trace I'm getting when I'm running
|
The following error is now raised if
This issue is verified fixed with linter version 3.16.0 |
Describe the problem and steps to reproduce it:
Run
addons-linter
on an add-on that has the following syntax errors in manifest.json:/browser_specific_settings/gecko/id
has the below non-string format:/applications.gecko.strict_min_version
not in string format:What happened?
The following error messages are received:
/browser_specific_settings/gecko/id
only letters:/browser_specific_settings/gecko/id
numbers+letters:/applications.gecko.strict_min_version
not in string format:manifestJson.applications.gecko.strict_min_version.split is not a function
What did you expect to happen?
For the
gecko/id
errors we should probably return the '/browser_specific_settings/gecko/id" should be string' error message. For the/applications.gecko.strict_min_version
error we should also have a validation message stating that this value should be in string format.The text was updated successfully, but these errors were encountered: