-
Notifications
You must be signed in to change notification settings - Fork 138
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
647: include all choice lists in output #736
Conversation
- no formatting changes, just keeping pace with ruff really
- allows users to include reference data for expressions via choices without needing a hidden dummy question. Includes all choices rather than parsing expressions to find references, because it seems unlikely that both a XLSForm would include completely irrelevant choices and have so many such choices that the XForm document size is a problem. - test_xls2json_xls.py - moved loop test into test_loop.py and modified to use the same style as the existing test - test_loop.py - use xls2xform.convert rather than internals directly
- xls2json.py: - move choices checks to new validator module - include row reference in all errors/warnings. To have a consistent error message structure, each duplicate choice gets a copy of the message (in one error) rather than being smushed into one message. - xlsparseutils.py - replace separate regex for xml tags with expression parser and use that instead, for consistent parsing rules and to use cache - move the remaining sheet misspellings check to new validator module - expression.py - fix issue where a name containing "or" or "and" was parsed as an operator rather than a name. These tokens are only valid when surrounded by spaces so the regex is updated accordingly. - add tests for positive and negative match cases for tag names.
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.
Much delight will be had, indeed!
One wording piece I want to check my understanding of. Otherwise looks great.
) | ||
INVALID_LABEL = ( | ||
"[row : {row}] On the 'choices' sheet, the 'label' value is invalid. " | ||
"Choices should have a label. " |
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.
This is optional/should because a choice list might now just be used for reference and not for a select?
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.
The reason for this check being a "should" / warning is to match existing behaviour - historically choice labels aren't required, but that might change per #534
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.
Ohhh, thank you for introducing me to my past self. :D
I agree this can close #630 and we can continue allowing : in the middle of an identifier. |
Hidden selects Begone! :-) +1 |
Closes #647
Closes #630
Why is this the best possible solution? Were any other approaches considered?
What are the regression risks?
Does this change require updates to documentation? If so, please file an issue here and include the link below.
I don't think so. The problem scenario for the choices sheet is probably not relevant to most users, and I don't think the dummy question workaround was documented (except on the forum?) but for those who wanted it to work and had to go looking for the workaround, well now it just works. As for the leading colon in the name, xlsform.org says what characters names can contain and colon isn't one of them.
Before submitting this PR, please make sure you have:
tests
python -m unittest
and verified all tests passruff format pyxform tests
andruff check pyxform tests
to lint code