Skip to content

Add codespell support (config, workflow to detect/not fix) and make it fix some typos - #903

Merged
bolinfest merged 4 commits into
openai:mainfrom
yarikoptic:enh-codespell
May 14, 2025
Merged

bolinfest merged 4 commits into
openai:mainfrom
yarikoptic:enh-codespell

Conversation

@yarikoptic

Copy link
Copy Markdown
Contributor

More about codespell: https://github.com/codespell-project/codespell .

I personally introduced it to dozens if not hundreds of projects already and so far only positive feedback.

CI workflow has 'permissions' set only to 'read' so also should be safe.

Let me know if just want to take typo fixes in and get rid of the CI

Signed-off-by: Yaroslav O. Halchenko <[email protected]>
…os automagically

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "codespell -w",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

Signed-off-by: Yaroslav O. Halchenko <[email protected]>
@github-actions

github-actions Bot commented May 12, 2025 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@yarikoptic

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 12, 2025

@bolinfest bolinfest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice! All the fixes are spot-on, so let's try it with the CI.

@bolinfest bolinfest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Out of an abundance of caution, can you please peg these to specific commits rather than tags? Since we don't own these CI jobs, they could change out from under us if we use tags.

Comment thread .github/workflows/codespell.yml Outdated
- name: Checkout
uses: actions/checkout@v4
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, but it seems just to work in my experience

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Right, I trust that it works today. What I have less confidence in is a bad actor coming in, somehow gaining control of codespell-problem-matcher, changing the v1 tag to point at something else, and anyone noticing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeap, there was a similar concern/practice elsewhere recently (argoproj/argo-workflows#14454) -- I will change now to current commit hashes... ran pin-github-action .github/workflows/codespell.yml and pushed

Comment thread .github/workflows/codespell.yml Outdated
- name: Annotate locations with typos
uses: codespell-project/codespell-problem-matcher@v1
- name: Codespell
uses: codespell-project/actions-codespell@v2

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry, what do you mean, since it is the one listed above

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy/paste error: that should have been https://github.com/codespell-project/actions-codespell. It has 21 forks and 80 stars, so it feels like at least some folks are keeping an eye on it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think there is still remaining confusion somewhere. We have two actions and they are complimentary:

  • codespell-project/codespell-problem-matcher@v1 -- this one is just to annotate in the github "files" view where typos are observed. handy but not mandatory, not as popular, no recent developments
  • codespell-project/actions-codespell@v2 -- the actual action to run codespell itself.

so I would recommend to keep both. First first one makes no sense without the 2nd one

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I am opting to keep both. I am saying that instead of referencing the actions by tag (@v1, @v2), I would like to reference them by full commit hash so the behavior of the action cannot change out from under us.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah, gotcha -- I just pushed replacing with commit hexshas

Comment thread .github/workflows/codespell.yml Resolved
…ious code ran

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "pin-github-action .github/workflows/codespell.yml --allow 'actions/*'",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^

@bolinfest bolinfest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

sorry, one last thing

Comment thread .github/workflows/codespell.yml Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This one is fine: this is GitHub's responsibility and if this does something malicious, the whole Internet will break anyway. So please keep this as @v4 so it's easier to eyeball that we're doing something canonical.

@bolinfest
bolinfest merged commit 327cf41 into openai:main May 14, 2025
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 2025
@bolinfest

Copy link
Copy Markdown
Collaborator

Thanks @yarikoptic: I'm excited to see this in action!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants