Add spell check workflow

This commit is contained in:
Zhizhen He 2023-02-22 15:35:22 +08:00
parent dd2cd101b1
commit 97a47d32b3
No known key found for this signature in database
GPG key ID: B5A215D74FCFD6A7
6 changed files with 22 additions and 11 deletions

View file

@ -2,6 +2,13 @@ name: reviewdog
on: [pull_request]
jobs:
typos:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: crate-ci/typos@v1.13.10
staticcheck:
name: staticcheck
runs-on: ubuntu-latest

View file

@ -34,7 +34,7 @@ var commandGet = &cli.Command{
&cli.BoolFlag{Name: "no-recursive", Usage: "prevent recursive fetching"},
&cli.StringFlag{Name: "branch", Aliases: []string{"b"},
Usage: "Specify `branch` name. This flag implies --single-branch on Git"},
&cli.BoolFlag{Name: "parallel", Aliases: []string{"P"}, Usage: "Import parallely"},
&cli.BoolFlag{Name: "parallel", Aliases: []string{"P"}, Usage: "Import parallelly"},
&cli.BoolFlag{Name: "bare", Usage: "Do a bare clone"},
},
}

View file

@ -166,9 +166,9 @@ func TestList_Symlink(t *testing.T) {
root := newTempDir(t)
symDir := newTempDir(t)
origLocalRepositryRoots := _localRepositoryRoots
origLocalRepositoryRoots := _localRepositoryRoots
_localRepositoryRoots = []string{root}
defer func() { _localRepositoryRoots = origLocalRepositryRoots }()
defer func() { _localRepositoryRoots = origLocalRepositoryRoots }()
if err := os.MkdirAll(filepath.Join(root, "github.com", "atom", "atom", ".git"), 0777); err != nil {
t.Fatal(err)
@ -199,9 +199,9 @@ func TestList_Symlink_In_Same_Directory(t *testing.T) {
root := newTempDir(t)
symDir := newTempDir(t)
origLocalRepositryRoots := _localRepositoryRoots
origLocalRepositoryRoots := _localRepositoryRoots
_localRepositoryRoots = []string{root}
defer func() { _localRepositoryRoots = origLocalRepositryRoots }()
defer func() { _localRepositoryRoots = origLocalRepositoryRoots }()
if err := os.MkdirAll(filepath.Join(root, "github.com", "root-user", "a-repository", ".git"), 0777); err != nil {
t.Fatal(err)

View file

@ -26,7 +26,7 @@ function _ghq () {
'--no-recursive[Prevent recursive fetching]' \
'--bare[Do a bare clone]' \
'(-b --branch)'{-b,--branch}'[Specify branch name]' \
'(-P --parallel)'{-P,--parallel}'[Import parallely]' \
'(-P --parallel)'{-P,--parallel}'[Import parallelly]' \
'(-)*:: :->null_state' \
&& ret=0
;;

View file

@ -13,11 +13,11 @@ import (
// A RemoteRepository represents a remote repository.
type RemoteRepository interface {
// The repository URL.
// URL returns the repository URL.
URL() *url.URL
// Checks if the URL is valid.
// IsValid checks if the URL is valid.
IsValid() bool
// The VCS backend that hosts the repository.
// VCS returns the VCS backend that hosts the repository.
VCS() (*VCSBackend, *url.URL, error)
}
@ -83,7 +83,7 @@ func (repo *DarksHubRepository) URL() *url.URL {
return repo.url
}
// IsValid determine if the darcshub repository is valid or not
// IsValid determine if the DarcsHub repository is valid or not
func (repo *DarksHubRepository) IsValid() bool {
return strings.Count(repo.url.Path, "/") == 2
}
@ -98,7 +98,7 @@ type CodeCommitRepository struct {
url *url.URL
}
// URL reutrns URL of the repository
// URL returns URL of the repository
func (repo *CodeCommitRepository) URL() *url.URL {
return repo.url
}

4
typos.toml Normal file
View file

@ -0,0 +1,4 @@
# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos
[default.extend-words]
[files]
extend-exclude = ["CHANGELOG.md"]