XLSForm / pyxform

A Python package to create XForms for ODK Collect.
BSD 2-Clause "Simplified" License
77 stars 134 forks source link

Do not warn on unlabeled field-lists #542

Closed yanokwa closed 2 years ago

yanokwa commented 2 years ago

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:

codecov-commenter commented 2 years ago

Codecov Report

Merging #542 (941fc08) into master (cf7ba39) will increase coverage by 0.04%. The diff coverage is 100.00%.

:exclamation: Current head 941fc08 differs from pull request most recent head 9ce6a38. Consider uploading reports for the commit 9ce6a38 to get more accurate results Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
pyxform/aliases.py 100.00% <100.00%> (ø)
pyxform/constants.py 100.00% <100.00%> (ø)
pyxform/xls2json.py 78.68% <100.00%> (+0.15%) :arrow_up:
pyxform/validators/util.py 77.45% <0.00%> (+0.30%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update cf7ba39...9ce6a38. Read the comment docs.

lognaturel commented 2 years ago

Is this ready for a look or any particular reason it's still a draft?

lognaturel commented 2 years ago

@lindsay-stevens and I discussed and are on board. He had to make some conflicting changes in https://github.com/XLSForm/pyxform/issues/439 so this will need to be reworked some.

yanokwa commented 2 years ago

Closing in favor of https://github.com/XLSForm/pyxform/pull/545