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

Upgrade spellcheckers #1429

Merged
merged 3 commits into from
Sep 9, 2023
Merged

Conversation

neiljp
Copy link
Collaborator

@neiljp neiljp commented Sep 9, 2023

What does this PR do, and why?

Other than keeping codespell and typos up to date with any extra spelling suggestions, the new version of typos allows configuration in pyproject.toml. Previous typos-specific workarounds were possible if adding a dedicated typos.toml, which I thought we'd previously added but avoided, which was the original motivation for looking at the latest typos version.

The pyproject.toml configuration is actually required for the upgrade due to O_WRONLY now appearing as a false positive. However, this also allows checking of the FAQ by typos, which was previously excluded from both tools due to the presence of iterm, by extending the allowed words list.

Ideally this would be simpler if tools added inline ignores (crate-ci/typos#316, codespell-project/codespell#1212), particularly if the format was common to multiple tools.

External discussion & connections

  • Discussed in #zulip-terminal in topic
  • Fully fixes #
  • Partially fixes issue #
  • Builds upon previous unmerged work in PR #
  • Is a follow-up to work in PR #
  • Requires merge of PR #
  • Merge will enable work on #

How did you test this?

  • Manually - Behavioral changes
  • Manually - Visual changes
  • Adapting existing automated tests
  • Adding automated tests for new behavior (or missing tests)
  • Existing automated tests should already cover this (only a refactor of tested code)

Self-review checklist for each commit

  • It is a minimal coherent idea
  • It has a commit summary following the documented style (title & body)
  • It has a commit summary describing the motivation and reasoning for the change
  • It individually passes linting and tests
  • It contains test additions for any new behavior
  • It flows clearly from a previous branch commit, and/or prepares for the next commit

@neiljp neiljp added the area: infrastructure Project infrastructure label Sep 9, 2023
@neiljp neiljp added this to the Next Release milestone Sep 9, 2023
@zulipbot zulipbot added the size: S [Automatic label added by zulipbot] label Sep 9, 2023
@neiljp neiljp merged commit a37d0c4 into zulip:main Sep 9, 2023
20 checks passed
@epage
Copy link

epage commented Sep 25, 2023

Ideally this would be simpler if tools added inline ignores (crate-ci/typos#316, codespell-project/codespell#1212), particularly if the format was common to multiple tools.

Would love to have a common format for this. In the mean time, I believe both tools have support for regex ignores and you can create your own directives with that.

@neiljp
Copy link
Collaborator Author

neiljp commented Sep 26, 2023

@epage I was thinking of the regexes originally as primarily only for individual word cases.

However, I just saw codespell-project/codespell#1212 (comment), and I'm experimenting with relaxing the file exclusion using something like the following to maintain some potential compatibility with cspell (or if adopted more generally):

  ....  # spellchecker:disable-line

That seems to work with codespell using a form of the regex in that comment, but using this in pyproject.toml doesn't appear to work for typos:

[tool.typos.default]
extend-ignore-re = [".*# spellchecker:disable-line$"]

Should those two forms be comparable? Is this related to a nuance with regexes? (in rust? in typos?)

@epage
Copy link

epage commented Sep 26, 2023

To use anchors like that, you need to enable multi-line mode; try extend-ignore-re = ["(?m)^.*# spellchecker:disable-line$"]. I tested this in crate-ci/typos#835

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: infrastructure Project infrastructure size: S [Automatic label added by zulipbot]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants