Skip to content
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

DM-4037: Require non-empty doc string for config parameters #100

Merged
merged 3 commits into from Jun 9, 2023

Conversation

enourbakhsh
Copy link
Contributor

@enourbakhsh enourbakhsh commented May 17, 2023

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@codecov
Copy link

codecov bot commented May 17, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.06 🎉

Comparison is base (38189d0) 85.18% compared to head (57e6323) 85.24%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #100      +/-   ##
==========================================
+ Coverage   85.18%   85.24%   +0.06%     
==========================================
  Files          46       46              
  Lines        3612     3627      +15     
==========================================
+ Hits         3077     3092      +15     
  Misses        535      535              
Impacted Files Coverage Δ
python/lsst/pex/config/config.py 90.43% <100.00%> (+0.04%) ⬆️
tests/test_Config.py 95.79% <100.00%> (+0.15%) ⬆️
tests/test_dictField.py 95.19% <100.00%> (ø)
tests/ticket2818helper/define.py 81.81% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

self.assertRaises(ValueError, pexConfig.RangeField, "doc", int, default=val, min=val, max=val - 1)
self.assertRaises(
ValueError, pexConfig.RangeField, "doc", float, default=val, min=val, max=val - 1e-15
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I have to be picky, I'd say this should be in its own commit because these two lines would pass regardless of your main change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would be a good commit message for it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Add missing docstrings for configs in unit tests" may be? It'd make sense to include just the new code changes in python/lsst/pex/config/config.py and the new unit test you added to be one commit ("Require non-empty docstring for config parameters"), and everything else in "Add missing docstrings for configs in unit tests".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is pre-existing style, but the current best practice for this assert is to do something like:

with self.assertRaises(ValueError):
    pexConfig.RangeField("doc", float, default=val, min=val, max=val - 1e-15)

Since that clearly separates the exception catching code from the code that should generate the error (and in context manager you can do extra things like catch the exception you do get or add extra lines to the block.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I implemented the current best practice for this assert using separate with blocks in my testDocstring() method but left the pre-existing occurrences untouched since there were too many. They probably need their own ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Add missing docstrings for configs in unit tests" may be? It'd make sense to include just the new code changes in python/lsst/pex/config/config.py and the new unit test you added to be one commit ("Require non-empty docstring for config parameters"), and everything else in "Add missing docstrings for configs in unit tests".

Done!

@enourbakhsh enourbakhsh force-pushed the tickets/DM-4037 branch 5 times, most recently from 0656019 to bbf5451 Compare May 19, 2023 03:00
Copy link
Member

@arunkannawadi arunkannawadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this package, requiring doc to be non-empty should be considered a user-visible change. I think it should belong in the misc category. You should add a file as described in doc/changes and a 1-line description that all config documentations need to be provided.

Copy link
Member

@arunkannawadi arunkannawadi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configuration fields

@enourbakhsh enourbakhsh merged commit b673666 into main Jun 9, 2023
9 checks passed
@enourbakhsh enourbakhsh deleted the tickets/DM-4037 branch June 9, 2023 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants