diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000000..a51e6239549 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +[codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = .git*,go.sum,*.lock,.codespellrc,vendor,translations,Keybindings_*.md +check-hidden = true +# camel-cased +ignore-regex = (\b[A-Za-z][a-z]*[A-Z]\S+\b|\.edn\b|\S+…|\\nd\b) +ignore-words-list = fomrat,inbetween diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000000..b026c855dd4 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -0,0 +1,25 @@ +# Codespell configuration is within .codespellrc +--- +name: Codespell + +on: + push: + branches: [master] + pull_request: + branches: [master] + +permissions: + contents: read + +jobs: + codespell: + name: Check for spelling errors + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Annotate locations with typos + uses: codespell-project/codespell-problem-matcher@v1 + - name: Codespell + uses: codespell-project/actions-codespell@v2 diff --git a/.gitignore b/.gitignore index 09340a6c9bf..b45afa96f58 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # Hidden .* +!.codespellrc # Notes *.notes diff --git a/docs/dev/Codebase_Guide.md b/docs/dev/Codebase_Guide.md index aaa6b358b17..1692be33ea6 100644 --- a/docs/dev/Codebase_Guide.md +++ b/docs/dev/Codebase_Guide.md @@ -2,7 +2,7 @@ ## Packages -* `pkg/app`: Contains startup code, inititalises a bunch of stuff like logging, the user config, etc, before starting the gui. Catches and handles some errors that the gui raises. +* `pkg/app`: Contains startup code, initialises a bunch of stuff like logging, the user config, etc, before starting the gui. Catches and handles some errors that the gui raises. * `pkg/app/daemon`: Contains code relating to the lazygit daemon. This could be better named: it's is not a daemon in the sense that it's a long-running background process; rather it's a short-lived background process that we pass to git for certain tasks, like GIT_EDITOR for when we want to set the TODO file for an interactive rebase. * `pkg/cheatsheet`: Generates the keybinding cheatsheets in `docs/keybindings`. * `pkg/commands/git_commands`: All communication to the git binary happens here. So for example there's a `Checkout` method which calls `git checkout`. diff --git a/docs/dev/Find_Base_Commit_For_Fixup_Design.md b/docs/dev/Find_Base_Commit_For_Fixup_Design.md index 4eff43b31fd..cf28bdae288 100644 --- a/docs/dev/Find_Base_Commit_For_Fixup_Design.md +++ b/docs/dev/Find_Base_Commit_For_Fixup_Design.md @@ -122,7 +122,7 @@ is this: "github.com/jesseduffield/lazygit/pkg/utils" + "github.com/samber/lo" "golang.org/x/sync/errgroup" -@@ -308,9 +309,5 @@ func (self *FixupHelper) blameAddedLines(addedLineHunks []*hunk) ([]string, erro +@@ -308,9 +309,5 @@ func (self *FixupHelper) blameAddedLines(addedLineHunks []*hunk) ([]string, error func findCommit(hash string) (*models.Commit, int, bool) { - for i, commit := range self.c.Model().Commits { - if commit.Hash == hash { diff --git a/pkg/commands/oscommands/cmd_obj_runner.go b/pkg/commands/oscommands/cmd_obj_runner.go index 1dd6ab2b277..41fedcfbcbd 100644 --- a/pkg/commands/oscommands/cmd_obj_runner.go +++ b/pkg/commands/oscommands/cmd_obj_runner.go @@ -319,7 +319,7 @@ func (self *cmdObjRunner) getCredentialPromptFn(cmdObj ICmdObj) (func(Credential } // runAndDetectCredentialRequest detect a username / password / passphrase question in a command -// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password or passphrase +// promptUserForCredential is a function that gets executed when this function detect you need to fill in a password or passphrase // The promptUserForCredential argument will be "username", "password" or "passphrase" and expects the user's password/passphrase or username back func (self *cmdObjRunner) runAndDetectCredentialRequest( cmdObj ICmdObj, diff --git a/pkg/gui/context/sub_commits_context.go b/pkg/gui/context/sub_commits_context.go index d1a63b75000..6adb7a53e98 100644 --- a/pkg/gui/context/sub_commits_context.go +++ b/pkg/gui/context/sub_commits_context.go @@ -40,7 +40,7 @@ func NewSubCommitsContext( getDisplayStrings := func(startIdx int, endIdx int) [][]string { // This can happen if a sub-commits view is asked to be rerendered while - // it is invisble; for example when switching screen modes, which + // it is invisible; for example when switching screen modes, which // rerenders all views. if viewModel.GetRef() == nil { return [][]string{} diff --git a/pkg/gui/controllers/helpers/confirmation_helper.go b/pkg/gui/controllers/helpers/confirmation_helper.go index 60329cbed61..43e2302721d 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper.go +++ b/pkg/gui/controllers/helpers/confirmation_helper.go @@ -347,7 +347,7 @@ func (self *ConfirmationHelper) resizeMenu(parentPopupContext types.Context) { } // Wraps the lines of the menu prompt to the available width and rerenders the -// menu if neeeded. Returns the number of lines the prompt takes up. +// menu if needed. Returns the number of lines the prompt takes up. func (self *ConfirmationHelper) layoutMenuPrompt(contentWidth int) int { oldPromptLines := self.c.Contexts().Menu.GetPromptLines() var promptLines []string diff --git a/pkg/gui/controllers/helpers/confirmation_helper_test.go b/pkg/gui/controllers/helpers/confirmation_helper_test.go index 76f4329fd3c..de3db935899 100644 --- a/pkg/gui/controllers/helpers/confirmation_helper_test.go +++ b/pkg/gui/controllers/helpers/confirmation_helper_test.go @@ -30,7 +30,7 @@ func Test_underlineLinks(t *testing.T) { expectedResult: "\x1b]8;;https://example.com\x1b\\https://example.com\x1b]8;;\x1b\\", }, { - name: "link preceeded and followed by text", + name: "link preceded and followed by text", text: "bla https://example.com xyz", expectedResult: "bla \x1b]8;;https://example.com\x1b\\https://example.com\x1b]8;;\x1b\\ xyz", }, diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index 7af45d14223..c43c3ddabb7 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -621,7 +621,7 @@ func (self *RefreshHelper) refreshStateFiles() error { // FilteredReflogCommits are rendered in the reflogs panel, and ReflogCommits // are used by the branches panel to obtain recency values for sorting. func (self *RefreshHelper) refreshReflogCommits() error { - // pulling state into its own variable incase it gets swapped out for another state + // pulling state into its own variable in case it gets swapped out for another state // and we get an out of bounds exception model := self.c.Model() var lastReflogCommit *models.Commit diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index f48a6b5951f..cacdb856429 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -20,7 +20,7 @@ const ( // When you open a popup over it, we'll let you return to it upon pressing escape PERSISTENT_POPUP // A temporary popup is one that could be used for various things (e.g. a generic menu or confirmation popup). - // Because we re-use these contexts, they're temporary in that you can't return to them after you've switched from them + // Because we reuse these contexts, they're temporary in that you can't return to them after you've switched from them // to some other context, because the context you switched to might actually be the same context but rendering different content. // We should really be able to spawn new contexts for menus/prompts so that we can actually return to old ones. TEMPORARY_POPUP diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index b1eff335e42..aa88d397a97 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -1720,7 +1720,7 @@ func EnglishTranslationSet() *TranslationSet { MovePatchIntoNewCommit: "Move patch into new commit", MovePatchIntoNewCommitTooltip: "Move the patch out of its commit and into a new commit sitting on top of the original commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then applying the patch to the index and committing it as a new commit, before continuing the rebase to completion. If later commits depend on the patch, you may need to resolve conflicts.", MovePatchToSelectedCommit: "Move patch to selected commit (%s)", - MovePatchToSelectedCommitTooltip: "Move the patch out of its original commit and into the selected commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then continuing the rebase up to the selected commit, before applying the patch forward and amending the seleced commit. The rebase is then continued to completion. If commits between the source and destination commit depend on the patch, you may need to resolve conflicts.", + MovePatchToSelectedCommitTooltip: "Move the patch out of its original commit and into the selected commit. This is achieved by starting an interactive rebase at the original commit, applying the patch in reverse, then continuing the rebase up to the selected commit, before applying the patch forward and amending the selected commit. The rebase is then continued to completion. If commits between the source and destination commit depend on the patch, you may need to resolve conflicts.", CopyPatchToClipboard: "Copy patch to clipboard", NoMatchesFor: "No matches for '%s' %s", ExitSearchMode: "%s: Exit search mode", diff --git a/pkg/integration/components/text_matcher.go b/pkg/integration/components/text_matcher.go index 8d80779222e..3970dc77879 100644 --- a/pkg/integration/components/text_matcher.go +++ b/pkg/integration/components/text_matcher.go @@ -96,7 +96,7 @@ func (self *TextMatcher) IsSelected() *TextMatcher { // if the matcher has an `IsSelected` rule, it returns true, along with the matcher after that rule has been removed func (self *TextMatcher) checkIsSelected() (bool, *TextMatcher) { - // copying into a new matcher in case we want to re-use the original later + // copying into a new matcher in case we want to reuse the original later newMatcher := &TextMatcher{Matcher: &Matcher[string]{}} *newMatcher.Matcher = *self.Matcher diff --git a/pkg/integration/components/view_driver.go b/pkg/integration/components/view_driver.go index 3abd63a9ebd..d6ee436cb72 100644 --- a/pkg/integration/components/view_driver.go +++ b/pkg/integration/components/view_driver.go @@ -75,7 +75,7 @@ func (self *ViewDriver) VisibleLines(matchers ...*TextMatcher) *ViewDriver { return self.assertLines(originY, matchers...) } -// asserts that somewhere in the view there are consequetive lines matching the given matchers. +// asserts that somewhere in the view there are consecutive lines matching the given matchers. func (self *ViewDriver) ContainsLines(matchers ...*TextMatcher) *ViewDriver { self.validateMatchersPassed(matchers) self.validateEnoughLines(matchers) diff --git a/pkg/integration/tests/branch/rebase_and_drop.go b/pkg/integration/tests/branch/rebase_and_drop.go index 60ef19e6ad1..594ae485457 100644 --- a/pkg/integration/tests/branch/rebase_and_drop.go +++ b/pkg/integration/tests/branch/rebase_and_drop.go @@ -13,7 +13,7 @@ var RebaseAndDrop = NewIntegrationTest(NewIntegrationTestArgs{ SetupConfig: func(config *config.AppConfig) {}, SetupRepo: func(shell *Shell) { shared.MergeConflictsSetup(shell) - // addin a couple additional commits so that we can drop one + // adding a couple additional commits so that we can drop one shell.EmptyCommit("to remove") shell.EmptyCommit("to keep") }, diff --git a/pkg/integration/tests/demo/custom_patch.go b/pkg/integration/tests/demo/custom_patch.go index 3a1440eda13..560073d3a6b 100644 --- a/pkg/integration/tests/demo/custom_patch.go +++ b/pkg/integration/tests/demo/custom_patch.go @@ -10,7 +10,7 @@ var usersFileContent = `package main import "fmt" func main() { - // TODO: verify that this actuall works + // TODO: verify that this actually works fmt.Println("hello world") } ` diff --git a/pkg/integration/tests/filter_and_search/nested_filter_transient.go b/pkg/integration/tests/filter_and_search/nested_filter_transient.go index bf04406f5a0..3bc8e78bb95 100644 --- a/pkg/integration/tests/filter_and_search/nested_filter_transient.go +++ b/pkg/integration/tests/filter_and_search/nested_filter_transient.go @@ -10,7 +10,7 @@ import ( // can be relocated elsewhere if you need them somewhere else. So for example if // I hit enter on a branch I'll see the sub-commits view, but if I then navigate // to the reflog context and hit enter on a reflog, the sub-commits view is moved -// to the reflog window. This is because we re-use the same view (it's a limitation +// to the reflog window. This is because we reuse the same view (it's a limitation // that would be nice to remove in the future). // Nonetheless, we need to ensure that upon moving the view, the filter is cancelled. diff --git a/pkg/integration/tests/misc/recent_repos_on_launch.go b/pkg/integration/tests/misc/recent_repos_on_launch.go index ac4309e6f82..8cf4382a59d 100644 --- a/pkg/integration/tests/misc/recent_repos_on_launch.go +++ b/pkg/integration/tests/misc/recent_repos_on_launch.go @@ -6,7 +6,7 @@ import ( ) // Couldn't find an easy way to actually reproduce the situation of opening outside a repo, -// so I'm introducing a hacky env var to force lazygit to show the recent repos meu upon opening. +// so I'm introducing a hacky env var to force lazygit to show the recent repos menu upon opening. var RecentReposOnLaunch = NewIntegrationTest(NewIntegrationTestArgs{ Description: "When opening to a menu, focus is correctly given to the menu", diff --git a/scripts/bisect.sh b/scripts/bisect.sh index 3652a85b8d7..72017e80685 100755 --- a/scripts/bisect.sh +++ b/scripts/bisect.sh @@ -11,7 +11,7 @@ # It's assumed that the current commit (i.e. HEAD) is broken. if [[ $# -ne 3 ]] ; then - echo 'Usage: scripts/bisect.sh ' + echo 'Usage: scripts/bisect.sh ' exit 1 fi