Closed Bug 1222055 Opened 9 years ago Closed 9 years ago

Update l20n parsers (js+python) to error on not-resolvable values

Categories

(Firefox OS Graveyard :: Gaia::L10n, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zbraniecki, Assigned: zbraniecki)

Details

Attachments

(1 file)

A conclusion from bug 1199670 comment 8 and bug 1199670 comment 9 is that we want to make l20n parser error when a value is not resolvable.
Attached file pull request
First, JS patch.
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Attachment #8685525 - Flags: review?(stas)
I looked at the patch a bit, and I found the boolean logic hard to understand.

There's a not equals undefined which gets negated into optional which means it could be missed.

That's like how many negations?

Maybe the code is easier to follow if it's using hasIndex and isRequired ?

I'm generally torn on the readability of the three optional args.

Lastly, it doesn't seem that the failure cases here got tests?
> Maybe the code is easier to follow if it's using hasIndex and isRequired ?

Named them :)

> Lastly, it doesn't seem that the failure cases here got tests?

Yup it's there, as part of hash errors test now.
I'm with Pike on the boolean logic here.  I wonder if isRequired (which I'd rename to valueRequired) is needed at all?
Comment on attachment 8685525 [details] [review]
pull request

Thanks for addressing the review comments.  r=me with one additional nit:  perhaps rename the arguments to getValue to `hasIndex` and `isRequired`?
Attachment #8685525 - Flags: review?(stas) → review+
Stas, so I looked at the code in parsers and I don't use the convention that you are suggesting - names of boolean variables do not follow "is*" or "has*".

If you're ok with not enforcing a style switch here, I'd prefer to land it in sync with the current code style in those files.
Flags: needinfo?(stas)
Yeah, absolutely, go for it!
Flags: needinfo?(stas)
Python patch: https://github.com/l20n/python-l20n/commit/25100ef5d78991c960c702481e8a342f85e4a22c

Pike, can you test it and confirm if it works for you?
Flags: needinfo?(l10n)
LGTM. I'm a tad torn on the mix between boolean and None for index, but I figured that out by now, I think.
Flags: needinfo?(l10n)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: