Read and use deprecated configuration (as well as emitting a warning)#9252
Read and use deprecated configuration (as well as emitting a warning)#9252bors merged 2 commits intorust-lang:masterfrom Metaswitch:use-deprecated-config
Conversation
Co-authored-by: Andy Caldwell <andycaldwell@microsoft.com>
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Jarcho (or someone else) soon. Please see the contribution instructions for more information. |
|
I only vaguely remember writing this 😅 Thanks for seeing it to an end! |
|
One small issue. This won't warn about duplicate fields when the old name appears after the new name. It's not a big deal as you still get the warning about the deprecated field. Otherwise LGTM. |
|
I've added a check to handle duplicates in either order and added a test for duplicates. I also extended the error message to be clear what's happening if one of the duplicates is using the deprecated name (though this only works on one direction). |
|
Thank you. That should be good enough. The deprecation warning mentions both names in either case. @bors r+ |
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Original change written by @flip1995 I've simply rebased to master and fixed up the formatting/tests. This change teaches the configuration parser which config key replaced a deprecated key and attempts to populate the latter from the former. If both keys are provided this fails with a duplicate key error (rather than attempting to guess which the user intended).
Currently this on affects
cyclomatic-complexity-threshold->cognitive-complexity-thresholdbut will also be used in #8974 to handleblacklisted-names->disallowed-names.cargo testpasses locallycargo dev fmt