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

style: fix typos #1996

Merged
merged 3 commits into from
Oct 27, 2024
Merged

style: fix typos #1996

merged 3 commits into from
Oct 27, 2024

Conversation

suzuki-shunsuke
Copy link
Contributor

What type of PR is this?

(REQUIRED)

  • documentation

What this PR does / why we need it:

(REQUIRED)

Which issue(s) this PR fixes:

(REQUIRED)

Fixes #1995

Special notes for your reviewer:

(fill-in or delete this section)

I'm using typos to detect and fix typo.

https://github.com/crate-ci/typos

typos supports auto fix, but it doesn't fix all typo and may have false positive.
We need to check if the fix is correct.
And we may need to configure typos.

Testing

(fill-in or delete this section)

Release Notes

(REQUIRED)


flag_test.go Outdated
ser0 := sl0.Serialize()
set0 := sl0.Serialize()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this is incorrect.

flag.go Outdated
pn := prefixedNames(f.Names(), placeholder)
on := prefixedNames(f.Names(), placeholder)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this is incorrect.
Maybe we should exclude *.go.

@suzuki-shunsuke
Copy link
Contributor Author

I excluded *.go.

typos -w --exclude '**/*.go'

@suzuki-shunsuke
Copy link
Contributor Author

test-docs failed.

https://github.com/urfave/cli/actions/runs/11535764321/job/32111183783?pr=1996

time="2024-10-26T23:31:54Z" level=info msg=done error_count=1 example_count=31 fields.time=8.317808798s source_count=16
time="2024-10-26T23:31:54Z" level=error msg="expected output does not match actual: \"serve: true\\noption: true\\nmessage: Some message\\n\" != \"\""
exit status 2

@suzuki-shunsuke
Copy link
Contributor Author

📝 make ensure-gfmrun doesn't work on Apple Silicon (darwin/arm64) because the pre-built binary of gfmrun for darwin/arm64 is missing.

cli/scripts/build.go

Lines 550 to 555 in 94107c2

gfmrunURL, err := url.Parse(
fmt.Sprintf(
"https://github.com/urfave/gfmrun/releases/download/%[1]s/gfmrun-%[2]s-%[3]s-%[1]s",
gfmrunVersion, runtime.GOOS, runtime.GOARCH,
),
)

https://github.com/urfave/gfmrun/releases

We need to build gfmrun for darwin/arm64 or use the asset for darwin/amd64.

@suzuki-shunsuke
Copy link
Contributor Author

😁 You can now install gfmrun using aqua, which is a modern CLI version manager.

@suzuki-shunsuke
Copy link
Contributor Author

I could reproduce the issue.

$ gfmrun --sources docs/v3/examples/combining-short-options.md
INFO[0000] loading                                       languages=/Users/shunsukesuzuki/.cache/gfmrun/languages.yml
INFO[0000] start                                         i=1/1 lang=go line=23 source=docs/v3/examples/combining-short-options.md
go: creating new go.mod: module gfmrun/example23
go: to add module requirements and sums:
	go mod tidy
go: finding module for package github.com/urfave/cli/v3
go: found github.com/urfave/cli/v3 in github.com/urfave/cli/v3 v3.0.0-alpha9.1
INFO[0002] finish                                        fields.time=2.041508375s i=1/1 lang=go line=23 source=docs/v3/examples/combining-short-options.md
INFO[0002] checked                                       fields.time=2.04220175s source=docs/v3/examples/combining-short-options.md
INFO[0002] done                                          error_count=1 example_count=1 fields.time=2.04255s source_count=1
ERRO[0002] expected output does not match actual: "serve: true\noption: true\nmessage: Some message\n" != ""

@@ -63,7 +63,7 @@ and `-m` respectively, setting `UseShortOptionHandling` will also support the
following syntax:

```
$ cmd -som "Some message"
$ cmd -some "Some message"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I see. som isn't typo.

@@ -93,9 +93,9 @@ import (

func main() {
cli.HelpFlag = cli.BoolFlag{
Name: "halp, haaaaalp",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, this isn't typo in this context.

```sh
typos -w
```
@suzuki-shunsuke suzuki-shunsuke marked this pull request as ready for review October 27, 2024 01:09
@suzuki-shunsuke suzuki-shunsuke requested a review from a team as a code owner October 27, 2024 01:09
@suzuki-shunsuke suzuki-shunsuke mentioned this pull request Oct 27, 2024
@suzuki-shunsuke
Copy link
Contributor Author

📝

$ typos
error: `Thar` should be `Than`, `That`
  --> ./docs/v3/examples/full-api-example.md:165:36
    |
165 |    fmt.Fprintf(cmd.Root().Writer, "Thar be no %q here.\n", command)
    |                                    ^^^^
    |
error: `ba` should be `by`, `be`
  --> ./suggestions_test.go:26:11
   |
26 |   {"aa", "ba", 0.6666666666666666},
   |           ^^
   |
error: `ba` should be `by`, `be`
  --> ./suggestions_test.go:27:5
   |
27 |   {"ba", "aa", 0.6666666666666666},
   |     ^^
   |
error: `hel` should be `help`, `hell`, `heal`
  --> ./suggestions_test.go:77:9
   |
77 |   {"", "hel", "--help"},
   |         ^^^
   |
error: `Thar` should be `Than`, `That`
  --> ./docs/v2/examples/full-api-example.md:174:34
    |
174 |    fmt.Fprintf(cCtx.App.Writer, "Thar be no %q here.\n", command)
    |                                  ^^^^
    |
error: `ist` should be `is`, `it`, `its`, `sit`, `list`
  --> ./docs/v1/examples/flags.md:441:23
    |
441 |     fmt.Println("yaml ist rad")
    |                       ^^^
    |
error: `Thar` should be `Than`, `That`
  --> ./docs/v1/examples/version-flag.md:249:32
    |
249 |     fmt.Fprintf(c.App.Writer, "Thar be no %q here.\n", command)
    |                                ^^^^
    |

_typos.toml Outdated
Copy link
Member

Choose a reason for hiding this comment

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

Since we are adding this file, should we also consider adding crate-ci/typos into our CI? https://github.com/crate-ci/typos/blob/master/docs/github-action.md

Copy link
Contributor

Choose a reason for hiding this comment

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

I would prefer a Go based tool that doesn't requires additional files.

Or the spellcheck that is completely configured from GitHub Action.

Copy link
Contributor Author

@suzuki-shunsuke suzuki-shunsuke Oct 27, 2024

Choose a reason for hiding this comment

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

Since we are adding this file, should we also consider adding crate-ci/typos into our CI?

Yeah, I agree. Or if we don't want to add this file, I'll simply remove it.

I would prefer a Go based tool that doesn't requires additional files.

For instance?

Or the spellcheck that is completely configured from GitHub Action.

This one?

https://github.com/marketplace/actions/github-spellcheck-action

I prefer a tool we can run both local and CI.
I like typos as it is built with Go and support auto fix.
But if there are better tools than typos, it should be fine.

There are some options.

  1. Remove _typos.toml
  2. Set up CI for typos
  3. Replace typos with other tool

I don't have strong motivation to introduce typos.
If we don't want to introduce it, let remove _typos.toml (option 1).

Copy link
Contributor

Choose a reason for hiding this comment

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

For instance?

I've seen big projects use https://vale.sh but for it somebody needs to build and write the docs https://github.com/urfave/cli/issues?q=is%3Aissue+is%3Aopen+label%3Akind%2Fdocumentation

I prefer a tool we can run both local and CI.

cli is a library. It does make sense if somebody runs code spellcheck once in a while, but for me spellchecking belongs to editor and CI, and not to the root files of a library project.

I like typos as it is built with Go and support auto fix.

No, it is a Rust project https://github.com/crate-ci/typos

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is a Rust project

Oh, sorry. I was wrong. 😅

Anyway, I don't think we should introduce typos now.
I'll remove _typos.toml.
Thank you for your review.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed. 76bcea5

@@ -71,7 +71,7 @@ The V2 changes were all shipped in [urfave/cli/pull/892](https://github.com/urfa
### Added

- Added `NewStringSlice` and `NewIntSlice` for creating their related types
- Added `Float64SliceFlag` for unmarshaling a list of floats from the user
- Added `Float64SliceFlag` for unmarshalling a list of floats from the user
Copy link
Member

Choose a reason for hiding this comment

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

This is correct (per U.S. English –which I suppose is used everywhere in software world)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your review.
I reverted the fix. 6591222

@suzuki-shunsuke suzuki-shunsuke changed the title docs: fix typos using typos style: fix typos using typos Oct 27, 2024
@suzuki-shunsuke suzuki-shunsuke changed the title style: fix typos using typos style: fix typos Oct 27, 2024
Copy link
Member

@Juneezee Juneezee left a comment

Choose a reason for hiding this comment

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

👍 Thanks for your PR

@Juneezee Juneezee merged commit 6524cf9 into urfave:main Oct 27, 2024
13 checks passed
@suzuki-shunsuke suzuki-shunsuke deleted the fix-typo branch October 27, 2024 22:33
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.

Fix typo
4 participants