diff --git a/_typos.toml b/_typos.toml new file mode 100644 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,23 @@ +[files] +# Don't check these files +extend-exclude = [ + ".git/", + "*.lock", + "go.mod", + "go.sum", +] + +[default.extend-words] +# False positives - words that typos incorrectly flags +# Go variable name commonly used for NiceDiff +"nd" = "nd" +# Acronym for "Does Not Exist" used in label operations +"DNE" = "DNE" +# CSS class for syntax highlighting (other) +"ot" = "ot" +# Brand name HashiCorp +"Hashi" = "Hashi" +# External API from goldmark-callout package (unfixable upstream typo) +"Extention" = "Extention" +# External API from goldmark package (unfixable upstream typo) +"Precending" = "Precending" diff --git a/appview/db/issues.go b/appview/db/issues.go --- a/appview/db/issues.go +++ b/appview/db/issues.go @@ -252,11 +252,11 @@ } } // collect references for each issue - allReferencs, err := GetReferencesAll(e, orm.FilterIn("from_at", issueAts)) + allReferences, err := GetReferencesAll(e, orm.FilterIn("from_at", issueAts)) if err != nil { return nil, fmt.Errorf("failed to query reference_links: %w", err) } - for issueAt, references := range allReferencs { + for issueAt, references := range allReferences { if issue, ok := issueMap[issueAt.String()]; ok { issue.References = references } @@ -452,11 +452,11 @@ } // collect references for each comments commentAts := slices.Collect(maps.Keys(commentMap)) - allReferencs, err := GetReferencesAll(e, orm.FilterIn("from_at", commentAts)) + allReferences, err := GetReferencesAll(e, orm.FilterIn("from_at", commentAts)) if err != nil { return nil, fmt.Errorf("failed to query reference_links: %w", err) } - for commentAt, references := range allReferencs { + for commentAt, references := range allReferences { if comment, ok := commentMap[commentAt.String()]; ok { comment.References = references } diff --git a/appview/db/notifications.go b/appview/db/notifications.go --- a/appview/db/notifications.go +++ b/appview/db/notifications.go @@ -191,7 +191,7 @@ if err != nil { return nil, fmt.Errorf("failed to parse created timestamp: %w", err) } - nwe := &models.NotificationWithEntity{Notification: &n} + entry := &models.NotificationWithEntity{Notification: &n} // populate repo if present if rId.Valid { @@ -211,7 +211,7 @@ } if rTopicStr.Valid { repo.Topics = strings.Fields(rTopicStr.String) } - nwe.Repo = &repo + entry.Repo = &repo } // populate issue if present @@ -229,7 +229,7 @@ } if iOpen.Valid { issue.Open = iOpen.Bool } - nwe.Issue = &issue + entry.Issue = &issue } // populate pull if present @@ -247,10 +247,10 @@ } if pState.Valid { pull.State = models.PullState(pState.Int64) } - nwe.Pull = &pull + entry.Pull = &pull } - notifications = append(notifications, nwe) + notifications = append(notifications, entry) } return notifications, nil diff --git a/appview/db/pulls.go b/appview/db/pulls.go --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -487,11 +487,11 @@ } // collect references for each comments commentAts := slices.Collect(maps.Keys(commentMap)) - allReferencs, err := GetReferencesAll(e, orm.FilterIn("from_at", commentAts)) + allReferences, err := GetReferencesAll(e, orm.FilterIn("from_at", commentAts)) if err != nil { return nil, fmt.Errorf("failed to query reference_links: %w", err) } - for commentAt, references := range allReferencs { + for commentAt, references := range allReferences { if comment, ok := commentMap[commentAt.String()]; ok { comment.References = references } diff --git a/appview/indexer/issues/indexer.go b/appview/indexer/issues/indexer.go --- a/appview/indexer/issues/indexer.go +++ b/appview/indexer/issues/indexer.go @@ -48,7 +48,7 @@ // Init initializes the indexer func (ix *Indexer) Init(ctx context.Context, e db.Execer) { l := tlog.FromContext(ctx) - existed, err := ix.intialize(ctx) + existed, err := ix.initialize(ctx) if err != nil { log.Fatalln("failed to initialize issue indexer", err) } @@ -117,7 +117,7 @@ return mapping, nil } -func (ix *Indexer) intialize(ctx context.Context) (bool, error) { +func (ix *Indexer) initialize(ctx context.Context) (bool, error) { if ix.indexer != nil { return false, errors.New("indexer is already initialized") } diff --git a/appview/indexer/pulls/indexer.go b/appview/indexer/pulls/indexer.go --- a/appview/indexer/pulls/indexer.go +++ b/appview/indexer/pulls/indexer.go @@ -47,7 +47,7 @@ // Init initializes the indexer func (ix *Indexer) Init(ctx context.Context, e db.Execer) { l := tlog.FromContext(ctx) - existed, err := ix.intialize(ctx) + existed, err := ix.initialize(ctx) if err != nil { log.Fatalln("failed to initialize pull indexer", err) } @@ -112,7 +112,7 @@ return mapping, nil } -func (ix *Indexer) intialize(ctx context.Context) (bool, error) { +func (ix *Indexer) initialize(ctx context.Context) (bool, error) { if ix.indexer != nil { return false, errors.New("indexer is already initialized") } diff --git a/appview/indexer/repos/indexer.go b/appview/indexer/repos/indexer.go --- a/appview/indexer/repos/indexer.go +++ b/appview/indexer/repos/indexer.go @@ -51,7 +51,7 @@ // Init initializes the indexer func (ix *Indexer) Init(ctx context.Context, e db.Execer) { l := tlog.FromContext(ctx) - existed, err := ix.intialize(ctx) + existed, err := ix.initialize(ctx) if err != nil { log.Fatalln("failed to initialize repo indexer", err) } @@ -188,7 +188,7 @@ return mapping, nil } -func (ix *Indexer) intialize(ctx context.Context) (bool, error) { +func (ix *Indexer) initialize(ctx context.Context) (bool, error) { if ix.indexer != nil { return false, errors.New("indexer is already initialized") } diff --git a/appview/ingester.go b/appview/ingester.go --- a/appview/ingester.go +++ b/appview/ingester.go @@ -818,7 +818,7 @@ if err != nil { return fmt.Errorf("failed to get registration: %w", err) } if len(registrations) != 1 { - return fmt.Errorf("got incorret number of registrations: %d, expected 1", len(registrations)) + return fmt.Errorf("got incorrect number of registrations: %d, expected 1", len(registrations)) } registration := registrations[0] @@ -1100,7 +1100,7 @@ return fmt.Errorf("failed to find subject: %w || subject count %d", err, len(i)) } repo = i[0].Repo default: - return fmt.Errorf("unsupport label subject: %s", collection) + return fmt.Errorf("unsupported label subject: %s", collection) } actx, err := db.NewLabelApplicationCtx(ddb, orm.FilterIn("at_uri", repo.Labels)) diff --git a/appview/issues/issues.go b/appview/issues/issues.go --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -602,7 +602,7 @@ defer tx.Rollback() _, err = db.AddIssueComment(tx, newComment) if err != nil { - l.Error("failed to perferom update-description query", "err", err) + l.Error("failed to perform update-description query", "err", err) rp.pages.Notice(w, "repo-notice", "Failed to update description, try again later.") return } diff --git a/appview/knots/knots.go b/appview/knots/knots.go --- a/appview/knots/knots.go +++ b/appview/knots/knots.go @@ -97,7 +97,7 @@ http.Error(w, "Not found", http.StatusNotFound) return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) return } registration := registrations[0] @@ -285,7 +285,7 @@ fail() return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) fail() return } @@ -394,7 +394,7 @@ fail() return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) fail() return } @@ -485,7 +485,7 @@ fail() return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) fail() return } @@ -521,7 +521,7 @@ l.Error("failed to get registration", "err", err) return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) return } registration := registrations[0] @@ -629,7 +629,7 @@ l.Error("failed to get registration", "err", err) return } if len(registrations) != 1 { - l.Error("got incorret number of registrations", "got", len(registrations), "expected", 1) + l.Error("got incorrect number of registrations", "got", len(registrations), "expected", 1) return } diff --git a/appview/middleware/middleware.go b/appview/middleware/middleware.go --- a/appview/middleware/middleware.go +++ b/appview/middleware/middleware.go @@ -124,7 +124,7 @@ actor := mw.oauth.GetMultiAccountUser(r) if actor == nil { // we need a logged in user l.Warn("not logged in, redirecting") - http.Error(w, "Forbiden", http.StatusUnauthorized) + http.Error(w, "Forbidden", http.StatusUnauthorized) return } domain := chi.URLParam(r, "domain") @@ -136,7 +136,7 @@ ok, err := mw.enforcer.E.HasGroupingPolicy(actor.Active.Did, group, domain) if err != nil || !ok { l.Warn("permission denied", "did", actor.Active.Did, "group", group, "domain", domain) - http.Error(w, "Forbiden", http.StatusUnauthorized) + http.Error(w, "Forbidden", http.StatusUnauthorized) return } @@ -158,7 +158,7 @@ actor := mw.oauth.GetMultiAccountUser(r) if actor == nil { // we need a logged in user l.Warn("not logged in, redirecting") - http.Error(w, "Forbiden", http.StatusUnauthorized) + http.Error(w, "Forbidden", http.StatusUnauthorized) return } f, err := mw.repoResolver.Resolve(r) @@ -170,7 +170,7 @@ ok, err := mw.enforcer.E.Enforce(actor.Active.Did, f.Knot, f.RepoIdentifier(), requiredPerm) if err != nil || !ok { l.Warn("permission denied", "did", actor.Active.Did, "perm", requiredPerm, "repo", f.RepoIdentifier()) - http.Error(w, "Forbiden", http.StatusUnauthorized) + http.Error(w, "Forbidden", http.StatusUnauthorized) return } @@ -332,7 +332,7 @@ // this should serve the go-import meta tag even if the path is technically // a 404 like tangled.sh/oppi.li/go-git/v5 // // we're keeping the tangled.sh go-import tag too to maintain backward -// compatiblity for modules that still point there. they will be redirected +// compatibility for modules that still point there. they will be redirected // to fetch source from tangled.org func (mw Middleware) GoImport() middlewareFunc { return func(next http.Handler) http.Handler { diff --git a/appview/models/notifications.go b/appview/models/notifications.go --- a/appview/models/notifications.go +++ b/appview/models/notifications.go @@ -104,7 +104,7 @@ return prefs.IssueCommented case NotificationTypeIssueClosed: return prefs.IssueClosed case NotificationTypeIssueReopen: - return prefs.IssueCreated // smae pref for now + return prefs.IssueCreated // same pref for now case NotificationTypePullCreated: return prefs.PullCreated case NotificationTypePullCommented: diff --git a/appview/pages/markup/reference_link.go b/appview/pages/markup/reference_link.go --- a/appview/pages/markup/reference_link.go +++ b/appview/pages/markup/reference_link.go @@ -16,7 +16,7 @@ ) // FindReferences collects all links referencing tangled-related objects // like issues, PRs, comments or even @-mentions -// This funciton doesn't actually check for the existence of records in the DB +// This function doesn't actually check for the existence of records in the DB // or the PDS; it merely returns a list of what are presumed to be references. func FindReferences(host string, source string) ([]string, []models.ReferenceLink) { var ( diff --git a/appview/pages/pages.go b/appview/pages/pages.go --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -52,7 +52,7 @@ logger *slog.Logger } func NewPages(config *config.Config, res *idresolver.Resolver, database *db.DB, logger *slog.Logger) *Pages { - // initialized with safe defaults, can be overriden per use + // initialized with safe defaults, can be overridden per use rctx := &markup.RenderContext{ IsDev: config.Core.Dev, Hostname: config.Core.AppviewHost, diff --git a/appview/pages/templates/repo/pipelines/workflow.html b/appview/pages/templates/repo/pipelines/workflow.html --- a/appview/pages/templates/repo/pipelines/workflow.html +++ b/appview/pages/templates/repo/pipelines/workflow.html @@ -12,7 +12,7 @@