Introducing spell checking and fixing several typos#934
Introducing spell checking and fixing several typos#934KostaIlic2 wants to merge 45 commits intoni:masterfrom
Conversation
Add cspell spell-checking configuration: - cspell.json with file/path scoping and Mako template override - cspell-dict.txt for project-specific technical terms - cspell-ignore-words.txt for known abbreviations and API identifiers - cspell-mako-keywords.txt for Mako template keywords Fix spelling errors in variable, function, file names, comments, docstrings, and test names throughout the codebase.
- Set noSuggest on all dictionaries so project-specific terms don't pollute suggestion lists - Add cspell-dict and cspell-daqmx-abbreviations to the Mako template override so abbreviations are recognized in templates - Merge duplicate entries in cspell-daqmx-abbreviations.txt (e.g. Conn # Connect / Connected / Connecting / Connector) - Add '# Real words' section header to cspell-dict.txt
…docs - Replace files allowlist with ignorePaths blocklist and useGitignore: true - Add docs/**/*.rst to spell-check scope - Add .cspell/cspell-sphinx-directives.txt dictionary for Sphinx RST directives - Add *.rst override to apply Sphinx directives dictionary
- Add per-file dictionaries and overrides for CHANGELOG.md and CONTRIBUTING.md - Add .cspell/cspell-changelog-words.txt with historical identifiers and bot names - Add .cspell/cspell-contributing-words.txt with contribution workflow terms - Add package names to cspell-dict.txt (numpy, ctypes, pytest, matplotlib, pyplot) - Add HWCU and NIDAQ to cspell-dict.txt - Add bitfields plural form to cspell-dict.txt - Add backlinks to cspell-sphinx-directives.txt - Add python dictionary to .rst override for code examples - fix: correct domaindirectives typo in CHANGELOG.md
|
Abbreviations file will need some additional work |
zhindes
left a comment
There was a problem hiding this comment.
I spot-checked everything, and it looks really nice. I don't live node in the workflow, but its not the worst, and the benefit seems good. Unless somebody knows an obvious alternative, I think I'm down. But! Let's block on Brad's review, too.
.cspell/cspell-dict.txt
Outdated
| @@ -0,0 +1,168 @@ | |||
| # Real words | |||
| nidaqmx | |||
There was a problem hiding this comment.
heck ya nidaqmx is a word!
| imports and format the code with Black, then manually fix any remaining errors. | ||
| 10. Run `poetry run mypy` to statically type-check the updated code. | ||
| 11. Send a GitHub Pull Request to the main repository's master branch. GitHub Pull Requests are the | ||
| 11. Run `npx cspell "**" --no-progress` to check for spelling errors. This requires [Node.js](https://nodejs.org/) to be installed. |
There was a problem hiding this comment.
How bad is it if engineers just wait for the PR to do it for them? At least for a while people will stumble into it. Does the error reporting look good?
| install_commands: list[list[str]] | ||
|
|
||
|
|
||
| # Mapping of distros to their command templates and version handlers |
There was a problem hiding this comment.
"distro" and "distros" are used often enough that I think we should consider them to be words
There was a problem hiding this comment.
distros is used in exactly one location in this body of code.
I did not add distro to the list because the singular form is already present in the software terms built-in dictionary.
I believe that the authors of that dictionary have given thought to plural form of such industry specific abbreviations.
Do you think that the readers of the comment will be confused by the fully spelled out word?
This seems like another candidate for a document about spelling.
| import typing | ||
|
|
||
| # region Task Counter IO namedtuples | ||
| # region Task Counter IO named tuples |
There was a problem hiding this comment.
namedtuple is a type word, I think we should allow namedtuple and namedtuples
There was a problem hiding this comment.
namedtuples is used in exactly one location in this body of code.
namedtuple is in cspell built-in python dictionary, and namedtuples is not.
I personally find the two real words with a space in between in the comment easier to understand. Do you think that this spelling will confuse any readers of the comment?
I prefer not to add plural form to our dictionary.
Objections?
There was a problem hiding this comment.
@mshafer-NI Here's what I think:
In prose, it is acceptable to convert class names to prose. For example, "Returns a GrpcEventHandler" -> "Returns a gRPC event handler".
It is also acceptable to use the class name as a modifier for another noun (kind of like a trademark). For example, "Returns a GrpcEventHandler" -> "Returns a GrpcEventHandler object".
Either of these techniques can be used to avoid pluralizing a class name. For example, "Returns a collection of GrpcEventHandlers" -> "Returns a collection of gRPC event handlers" or "Returns a collection of GrpcEventHandler objects".
Also, I thought I converted all of these namedtuple classes to use typing.NamedTuple. 😅
Thanks. I will try to take a look at this later today. |
src/codegen/templates/library_interpreter/default_c_function_call.py.mako
Show resolved
Hide resolved
There was a problem hiding this comment.
https://peps.python.org/pep-0008/#package-and-module-names
Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability.
IMO "_dotenvpath.py" is sufficiently readable.
Also, "dot" and "env" are separate words. The fact that there is a deprecated package we are not using called https://pypi.org/project/dotenv/ is a result of the Python naming conventions saying that separating words with underscores is optional.
There was a problem hiding this comment.
Interesting that the wording in PEP-8 is slightlty different for module names and variable/function names.
Given the wording for module names, I can argue that adding the underscore improves readability. The guide does not make inclusion of underscores conditional on insufficient readability without the underscores.
There was a problem hiding this comment.
I created #938 to remember to rename the file in a separate PR.
742255f to
5f0f91a
Compare
cspell treats \b as a regex metacharacter, so r"\bnptdms\b" produces the token nptdms, which is already in the dictionary. The bnptdms entry was never needed.
7070eb2 to
2aad129
Compare
… python dict to changelog override
|
@bkeryan, @mshafer-NI, @zhindes, To reduce the number of dictionary files, I tried two alternative approaches for two markdown files - both based on inlining CONTRIBUTING.md: one word per line at the top of the file — simple, easy to maintain, but adds noise before the prose. CHANGELOG.md: one comment immediately above the line where each term is introduced — better locality, and the ignore naturally disappears if the entry is ever removed. The trade-off vs. dictionary files is discoverability: someone maintaining the file can see exactly why a word is ignored and where it comes from, without having to cross-reference the I would appreciate your feedback on this topic. Do you have a preference between the three approaches? ... 2 days later |
|
We have redundancy in coverage for two markdown files for discussion purposes. After the discussion is over, I need to remove the redunancy ... 2 days later. |
Add .cspell/cspell-codegen-dict.txt with ~115 entries covering NI-DAQmx initialisms, abbreviations, compound identifiers, typos locked in public API names, and real domain words specific to codegen and generated source files. Update cspell.json: - Add cspell-codegen-dict dictionary definition - Remove broad generated/** and src/codegen/** ignore paths so these files are now spell-checked - Add generated/nidaqmx/_stubs/** back to ignorePaths (protobuf stubs are too noisy to check) - Add override applying cspell-codegen-dict to src/codegen/** and generated/** - Sort dictionaryDefinitions alphabetically - Order ignorePaths to match VSCode Explorer layout - Add ordering comments to both lists Fix typos in metadata source (src/codegen/metadata/attributes.py): - specfied -> specified - thermcouple -> thermocouple - thefilter -> the filter (two occurrences) These propagate into generated files via codegen; also fix them directly in the generated files that are already up to date. Minor code fixes: - src/codegen/generator.py: docstring "Codegenerator" -> "Code generator" - src/codegen/stub_generator.py: rename grpc_codegened_file_paths -> grpc_code_generated_file_paths
- Remove pyproject.toml from cspell.json ignorePaths - Add cspell override for pyproject.toml with [cspell-dict, cspell-daqmx-abbreviations, python] dictionaries; the python dictionary covers: mypy, pypy, grpcio, tzlocal, doctest, filterwarnings, xfail - Add // cspell:disable-line to the override's filename line in cspell.json to suppress pyproject in that string literal - Suppress maintainer names (Hindes, Maxx, Boehme, Keryan) using # cspell:disable / # cspell:enable around the maintainers block - Add # cspell:ignore addopts above [tool.pytest.ini_options].addopts - Add # cspell:ignore testpaths above [tool.pytest.ini_options].testpaths - Add grpcdevice and styleguide to .cspell/cspell-dict.txt - Remove grpcdevice from .cspell/cspell-changelog-words.txt - Remove styleguide from .cspell/cspell-changelog-words.txt and .cspell/cspell-contributing-words.txt - Remove <!-- cspell:ignore styleguide --> from CONTRIBUTING.md - Remove <!-- cspell:ignore styleguide --> and <!-- cspell:ignore grpcdevice --> from CHANGELOG.md
…rary_interpreter.py
…nary Improve comments in cspell-daqmx-api-elements.txt for consistency: - Use specific comment taxonomy: abbreviation, unseparated words, unseparated initialisms, initialism, Typo, Deprecated - Move mioDAQ to cspell-real-words.txt - Move forcebridge/pressurebridge/torquebridge to cspell-project-software-terms.txt (typo: filenames should be PascalCase) - Move installdriver to cspell-project-software-terms.txt (CLI command) - Reclassify BBULK, COULDNT, DOESNT, DAQError, notKnown, zidx with accurate comments instead of 'compatibility breaking name'
forcebridge.ted → ForceBridge.ted pressurebridge.ted → PressureBridge.ted torquebridge.ted → TorqueBridge.ted Update conftest.py fixtures and remove the words from the cspell dictionary.
- Remove redundant "Real word:" and "Initialism:" prefixes from comments - Lowercase entries that are neither initialisms nor proper nouns - Add descriptions to bare entries - Standardize GPS initialism comments - Correct SMIO expansion: Serial Memory I/O -> Simultaneously-sampling Multifunction I/O
- Move cspell.json to .config/cspell.json
- Move .cspell/ dictionary files to .config/cspell/, dropping the
redundant "cspell-" prefix from each filename and dictionary name
- Add globRoot: "${cwd}" so paths resolve correctly from the new location
- Set noSuggest: false on real-words to enable spelling suggestions
bkeryan
left a comment
There was a problem hiding this comment.
Approved with suggestions: update PR description and CHANGELOG.md
There was a problem hiding this comment.
This metadata comes from one of our internal Git repos. I will post a PR to fix it there so this doesn't get reverted the next time someone updates this file based on the internal metadata.
src/codegen/templates/library_interpreter/default_c_function_call.py.mako
Show resolved
Hide resolved
There was a problem hiding this comment.
This contribution adheres to CONTRIBUTING.md.
I have not run tests locally
TODO: Check the above box with an 'x' indicating you've read and followed CONTRIBUTING.md.
That's okay. Everything passes in the PR workflow, except for "Run system tests (win-10-py32)" which is an intermittent issue with the self-hosted runner used for that job.
I've updated CHANGELOG.md if applicable.
TODO: Check the above box with an 'x' if considered if there were any and then documented client facing changes in CHANGELOG.md. Strike through if this is not a relevant client facing change.
Please add a bullet point saying the project now uses cspell for spell checking.
We forgot to add the 1.5.0 section after releasing 1.4.0, so please add it to the top:
## 1.5.0
* ### Merged Pull Requests
* [Full changelog: 1.4.0...1.5.0](https://github.com/ni/nidaqmx-python/compare/1.5.0...1.5.0)
* ### Resolved Issues
* ...
* ### Major Changes
* ...
* ### Known Issues
* ...
I've added tests applicable for this pull request
TODO: Check the above box with an 'x' indicating you have considered and added any applicable system or unit tests. Strike through if you considered and decided additional tests were not warranted.
Strike through this, e.g. - [ ] ~~blah blah~~
There was a problem hiding this comment.
We forgot to add the 1.5.0 section after releasing 1.4.0, so please add it to the top:
Correction: this was done a month ago. Please rebase/merge against the latest master branch.

I have not run tests locally
TODO: Check the above box with an 'x' indicating you've read and followed CONTRIBUTING.md.
TODO: Check the above box with an 'x' if considered if there were any and then documented client facing changes in CHANGELOG.md. Strike through if this is not a relevant client facing change.
TODO: Check the above box with an 'x' indicating you have considered and added any applicable system or unit tests. Strike through if you considered and decided additional tests were not warranted.
What does this Pull Request accomplish?
I introduced configuration and dictionaries for cspell spell checker. I fixed several typos.
Why should this Pull Request be merged?
To eliminate typos present now and reduce probability of typos in the future.
What testing has been done?
I ran all static checks and generated documentation. And I ran the spell checker.
I skipped regression tests. I hope PR CI covers that.