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 to check-spelling v0.0.22 #3896

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

jsoref
Copy link
Contributor

@jsoref jsoref commented Nov 15, 2023


Changes:

  • general spelling/grammar
  • refreshed baseline metadata (roughly spell-check-this@82d4530)
  • upgraded to check-spelling v0.0.22
  • refreshed workflow
  • enabling sarif output (when possible) -- this is, of course, optional, enabling it requires granting an additional permission, but as this is the only action for the repository, that shouldn't be a problem -- the output is a lot shinier thanks to github's sarif handling than the older output mode
  • enabling talking to the workflow (when in a PR but not to this repository) -- this lets users in their own forks ask the workflow to update the expect file for them instead of requiring them to run commands on their local computer
Microsoft Reviewers: Open in CodeFlow

@jsoref jsoref requested a review from a team as a code owner November 15, 2023 17:27
Comment on lines -91 to -93
# Because it doesn't handle argument -Words well
^tools/CorrelationTestbed/.*\.ps1$
^tools/COMTrace/ComTrace.wprp$
Copy link
Contributor Author

Choose a reason for hiding this comment

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

afaict this is no longer a problem, so I'm dropping it

Comment on lines -423 to -432
TOperation
TOptions
TProgress
TResult
TReturn
trimstart
TState
TStatus
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These T[A-Z] items are handled by a pattern below.

.github/actions/spelling/patterns.txt Show resolved Hide resolved
.github/workflows/spelling3.yml Outdated Show resolved Hide resolved
Comment on lines -65 to +89
if: "contains(github.event_name, 'pull_request') || github.event_name == 'push'"
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is purely stylistic -- the vscode github integration doesn't like "..." whereas GitHub Actions do not mind.

.github/workflows/spelling3.yml Outdated Show resolved Hide resolved
.github/workflows/spelling3.yml Outdated Show resolved Hide resolved
extra_dictionaries:
cspell:cpp/src/compiler-msvc.txt
cspell:cpp/src/cpp.txt
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this dictionary is lousy (way too many typos included, similar to the win32 dictionary) -- as of v0.0.22, I 🗑️ Removed (both) Dictionaries from the suggestion list due to their poor quality.

I did look into trying to fix them, but they had so many typos that I ran out of energy trying to go over them.

Copy link
Member

Choose a reason for hiding this comment

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

I can see why you wouldn't want to suggest the lousy dictionaries, but I'm not totally convinced it is better for us to not use them. I'm not too invested in that position, though.

The downside I see to using them is that if we happen to make the same typo, we wouldn't notice. To me that seems somewhat unlikely, and if it does happen doesn't seem like that big of a deal. I assume the dictionary would get better over time, so those typos would eventually come up.
As for upsides, it will be easier for us to manage the lists of allow/expect if we have to add less words. If we have to add lots of words, I think it's more likely we're going to make another mistake like with "uknown"

.github/workflows/spelling3.yml Outdated Show resolved Hide resolved
Comment on lines +154 to +173
experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }}

update:
name: Update PR
permissions:
contents: write
pull-requests: write
actions: read
runs-on: ubuntu-latest
if: ${{
github.repository_owner != 'microsoft' &&
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@check-spelling-bot apply')
}}
concurrency:
group: spelling-update-${{ github.event.issue.number }}
cancel-in-progress: false
steps:
- name: apply spelling updates
uses: check-spelling/check-spelling@v0.0.22
with:
experimental_apply_changes_via_bot: 1
checkout: true
ssh_key: "${{ secrets.CHECK_SPELLING }}"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is, as noted, very optional, but it should make it easier for others to interact with the workflow instead of having to run programs on their own computer.

florelis
florelis previously approved these changes Nov 15, 2023
.github/actions/spelling/candidate.patterns Outdated Show resolved Hide resolved
.github/actions/spelling/excludes.txt Outdated Show resolved Hide resolved
.github/actions/spelling/excludes.txt Outdated Show resolved Hide resolved
.github/actions/spelling/patterns.txt Show resolved Hide resolved
.github/actions/spelling/expect.txt Show resolved Hide resolved
extra_dictionaries:
cspell:cpp/src/compiler-msvc.txt
cspell:cpp/src/cpp.txt
Copy link
Member

Choose a reason for hiding this comment

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

I can see why you wouldn't want to suggest the lousy dictionaries, but I'm not totally convinced it is better for us to not use them. I'm not too invested in that position, though.

The downside I see to using them is that if we happen to make the same typo, we wouldn't notice. To me that seems somewhat unlikely, and if it does happen doesn't seem like that big of a deal. I assume the dictionary would get better over time, so those typos would eventually come up.
As for upsides, it will be easier for us to manage the lists of allow/expect if we have to add less words. If we have to add lots of words, I think it's more likely we're going to make another mistake like with "uknown"

Comment on lines +75 to +77
issue_comment:
types:
- 'created'
Copy link
Member

Choose a reason for hiding this comment

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

What does this do? Check spelling when someone creates an issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When someone comments on an issue/PR it will trigger the workflow. Each job independently decides whether to do anything.

For,


It'll do nothing:
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}

For,


It'll do nothing:
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'

For,


It'll do nothing:
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')

It will only do work here:

update:
name: Update PR
permissions:
contents: write
pull-requests: write
actions: read
runs-on: ubuntu-latest
if: ${{
github.repository_owner != 'microsoft' &&
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@check-spelling-bot apply')
}}

One of the criteria being that it isn't this repository.

If someone creates a PR within a single fork and it triggers a comment w/ a note about items that should be added to expect, the comment will include something like this from @check-spelling-bot:

Copy link
Member

@JohnMcPMS JohnMcPMS left a comment

Choose a reason for hiding this comment

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

Cannot allow write permissions.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback Issue needs attention from issue or PR author Needs-Attention Issue needs attention from Microsoft and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Dec 12, 2023
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
@denelon
Copy link
Contributor

denelon commented Jan 6, 2024

We use a "template: foo/bar/baz" type of convention for messages from bots so it's easy to build e-mail rules to filter those out. How hard would it be to add something like that to the spellcheck messages in PRs?

@jsoref
Copy link
Contributor Author

jsoref commented Jan 6, 2024

@denelon, add a line to https://github.com/microsoft/winget-cli/blob/master/.github/actions/spelling/advice.md

You could even add it of the form:

<!--
template: check-spelling
-->

So that it's only seen by mail filters and not by humans.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Attention Issue needs attention from Microsoft
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants