Fix several API typos and document the process in CONTRIBUTING.md#943
Fix several API typos and document the process in CONTRIBUTING.md#943KostaIlic2 wants to merge 1 commit intoni:masterfrom
Conversation
… document the process in CONTRIBUTING.md
2733a11 to
72366c7
Compare
There was a problem hiding this comment.
Including misspelled words like "attentuation" in the dictionary allows us to use the same misspelling elsewhere.
I think it would be better to put the misspelled constant in the dictionary (e.g. "INVALID_ATTENTUATION_BASED_ON_MIN_MAX") so that we catch other instances of the misspelled word.
There was a problem hiding this comment.
Since we are not fixing the misspellings in the metadata at this time, please file a bug to the Platform Drivers Venus team about the misspellings in the C and .NET APIs.
Thankfully, https://github.com/ni/grpc-device/blob/main/generated/nidaqmx/nidaqmx.proto is not affected because it doesn't include error code constants.
There was a problem hiding this comment.
This will have to be updated if/when the misspellings are fixed in the internal DAQmx metadata. The substitutions will need to be reversed, so that it adds the misspellings instead of fixing them.
Here's another way to fix the misspellings that wouldn't have this problem:
- Add code to https://github.com/ni/nidaqmx-python/blob/master/src/codegen/metadata/__init__.py that patches the misspelled error codes
- Hardcode the compatibility entries at the bottom of this template
This way, the compatibility items will still exist if/when the misspellings are fixed upstream.
There was a problem hiding this comment.
Component and Unit Tests
- Organized to parallel production code (and test utility code)
- The test file name is test_*.py, where * is the name of the entity tested, e.g. the name of the class, optionally followed by flavor or differentiator, or just the name of the module being unit tested. The name would follow snake_case style. Example: if the class is MyClass, the associated test file would be test_my_class.py.
In nidaqmx-python, we generally name component/unit tests after the module that we are testing.
|
|
||
| * ### Major Changes | ||
| * [cspell](https://cspell.org/) is now used for spell checking. | ||
| * The following `DAQmxErrors` enum members were renamed to fix typos inherited from the C API: |
There was a problem hiding this comment.
"inherited from the C API" makes it sound like this is not under our control, which is not the case.
| * The following `DAQmxErrors` enum members were renamed to fix typos inherited from the C API: | |
| * The following `DAQmxErrors` enum members were renamed to fix typos: |
There was a problem hiding this comment.
Please don't document how to fix specific types of typos. They should be rare and documenting this makes the document harder to read and maintain.
I think it's ok to include some basic guidelines:
- If you fix a misspelling in the public API, please ensure that the fix preserves compatibility with code using the old name.
- When you add misspellings to the cspell dictionaries, please be as specific as possible and include the full class/constant/function name in order to catch other instances of the same misspelling.
| ] | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("old_name,new_name", _RENAMED_ERROR_CODES) |
There was a problem hiding this comment.
In this instance, I do not think that parametrization has any advantage over the simple approach:
assert DAQmxErrors.FILTER_DELAY_REMOVAL_NOT_POSSSIBLE_WITH_ANALOG_TRIGGER is DAQmxErrors.FILTER_DELAY_REMOVAL_NOT_POSSIBLE_WITH_ANALOG_TRIGGER
...
| * ### Major Changes | ||
| * [cspell](https://cspell.org/) is now used for spell checking. | ||
| * The following `DAQmxErrors` enum members were renamed to fix typos inherited from the C API: | ||
| * `FILTER_DELAY_REMOVAL_NOT_POSSSIBLE_WITH_ANALOG_TRIGGER` → `FILTER_DELAY_REMOVAL_NOT_POSSIBLE_WITH_ANALOG_TRIGGER` |
There was a problem hiding this comment.
re: the arrows: fine, I guess?
zhindes
left a comment
There was a problem hiding this comment.
Brad covered everything :)
What does this Pull Request accomplish?
Fixes #939
I renamed 6 DAQmxErrors members, kept old names as aliases, and documented the process for fixing typos in API names in CONTRIBUTING.md.
Why should this Pull Request be merged?
So users don't have to use error code names with typos.
What testing has been done?
New unit test was added.