Skip to content

Fix several API typos and document the process in CONTRIBUTING.md#943

Draft
KostaIlic2 wants to merge 1 commit intoni:masterfrom
KostaIlic2:users/kosta/fix-several-api-typos
Draft

Fix several API typos and document the process in CONTRIBUTING.md#943
KostaIlic2 wants to merge 1 commit intoni:masterfrom
KostaIlic2:users/kosta/fix-several-api-typos

Conversation

@KostaIlic2
Copy link
Contributor

@KostaIlic2 KostaIlic2 commented Mar 18, 2026

  • This contribution adheres to CONTRIBUTING.md.
  • I've updated CHANGELOG.md if applicable.
  • I've added tests applicable for this pull request

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.

@KostaIlic2 KostaIlic2 marked this pull request as ready for review March 18, 2026 17:00
@KostaIlic2 KostaIlic2 force-pushed the users/kosta/fix-several-api-typos branch from 2733a11 to 72366c7 Compare March 18, 2026 18:29
Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

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:

This way, the compatibility items will still exist if/when the misspellings are fixed upstream.

Cc: @zhindes @hongloonwong

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://dev.azure.com/ni/DevCentral/_wiki/wikis/AppCentral.wiki/20934/Regression-Test-Conventions?anchor=component-and-unit-tests

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:
Copy link
Collaborator

Choose a reason for hiding this comment

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

"inherited from the C API" makes it sound like this is not under our control, which is not the case.

Suggested change
* 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:

Copy link
Collaborator

Choose a reason for hiding this comment

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

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)
Copy link
Collaborator

Choose a reason for hiding this comment

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

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`
Copy link
Collaborator

Choose a reason for hiding this comment

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

re: the arrows: fine, I guess?

Copy link
Collaborator

@zhindes zhindes left a comment

Choose a reason for hiding this comment

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

Brad covered everything :)

@KostaIlic2
Copy link
Contributor Author

@bkeryan and @zhindes, After submitting this PR, I reflected on the changes, and started looking into additional changes I would like to make. It will take me a while to process the feedback and my own afterthoughts.

@KostaIlic2 KostaIlic2 marked this pull request as draft March 19, 2026 13:31
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.

Potential typos in the API

3 participants