-
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
Do not warn on unlabeled field-lists #542
Conversation
a2beca0
to
941fc08
Compare
Codecov Report
@@ Coverage Diff @@
## master #542 +/- ##
==========================================
+ Coverage 83.88% 83.93% +0.04%
==========================================
Files 25 25
Lines 3736 3741 +5
Branches 872 873 +1
==========================================
+ Hits 3134 3140 +6
+ Misses 455 454 -1
Partials 147 147
Continue to review full report at Codecov.
|
Is this ready for a look or any particular reason it's still a draft? |
- label check block applies to questions and other item types such as groups and repeats, so may be valid in other scenarios - for example this block is referenced in XLSForm#542 - will require further changes to exclude question items from the check since that is the intent in XLSForm#439
@lindsay-stevens and I discussed and are on board. He had to make some conflicting changes in #439 so this will need to be reworked some. |
b0ccab6
to
0ce77b0
Compare
- as per pyxform/XLSForm#439, should always output a label node even if there is no label specified. - pyxform had a warning for no label but this is removed since there is no requirement for a label. - add tests to verify that a label is output and no warning raised - fix existing tests that either expected a warning or no label
- some clients hide the guidance hint by default, in which case the user would see nothing / a small (i) symbol if a question had only a guidance hint without any label (or media) or hint - update test_guidance_hint.py tests accordingly - change newly added test from ss_structure to md-style - removed e2e tests and associated files; more or less the same as the test immediately above in test_sheet_columns.py
- label check block applies to questions and other item types such as groups and repeats, so may be valid in other scenarios - for example this block is referenced in XLSForm#542 - will require further changes to exclude question items from the check since that is the intent in XLSForm#439
- as noted in the comment, the check doesn't apply to questions anymore since PR XLSForm#543 makes pyxform always emit a label, and the only case that is not permissible is a guidance_hint with no label or hint. - nesting this check inside the "control group" processing branch seems the only neat+easy way about this, since: - the context is a loop from which the various branches continue, so it can't check at the end, - each branch parses / determines the actual item type which is not apparent in the raw "type" data from the row dict, and - after the loop context exits, the data is in an array with nested dicts so it's no longer possible to determine the sheet row number for the error message to be as useful to users. - refactored an old test which covers a lot of question types, into the tests_v1 / md style since this test is affected by the changes and having md style is more transparent - added some tests to verify the assumption that for the label check, it's not going to encounter a None or empty value for "control_type".
0ce77b0
to
9ce6a38
Compare
Closing in favor of #545 |
Too many warnings make it hard for users to see things they should be actually warned about. In this case, users use field-lists to visually group questions and that grouping really doesn't need a label, so we don't need to warn users.
And while I was looking at the warnings, I wanted to improve them by specifying that the warning was about a group or a repeat.
Why is this the best possible solution? Were any other approaches considered?
Originally, I wanted to warn on every group and every repeat, but decided to dial it back because...
What are the regression risks?
There could be some downstream tools that rely on group labels, but since has always been a warning and not an error, it seems likely that those tools can handle missing group labels.
There doesn't seem to be a fixed list of acceptable ways to say "begin group". There is a regex in https://github.com/XLSForm/pyxform/blob/master/pyxform/xls2json.py#L570 that I built my tests around.
Finally, there isn't a lot of test coverage on groups, so that didn't make me feel great.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
No, infact https://xlsform.org/en/#multiple-webpage-forms shows an example of a field-list without a label.
Before submitting this PR, please make sure you have:
tests_v1
nosetests
and verified all tests passblack pyxform
to format code