diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 00000000..1a191c43 --- /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 index 8016a2a1..244b9f5d 100644 --- a/appview/db/issues.go +++ b/appview/db/issues.go @@ -252,11 +252,11 @@ func GetIssuesPaginated(e Execer, page pagination.Page, filters ...orm.Filter) ( } // 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 @@ func GetIssueComments(e Execer, filters ...orm.Filter) ([]models.IssueComment, e // 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 index a244fb84..c8fcafbc 100644 --- a/appview/db/notifications.go +++ b/appview/db/notifications.go @@ -191,7 +191,7 @@ func GetNotificationsWithEntities(e Execer, page pagination.Page, filters ...orm 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 @@ func GetNotificationsWithEntities(e Execer, page pagination.Page, filters ...orm if rTopicStr.Valid { repo.Topics = strings.Fields(rTopicStr.String) } - nwe.Repo = &repo + entry.Repo = &repo } // populate issue if present @@ -229,7 +229,7 @@ func GetNotificationsWithEntities(e Execer, page pagination.Page, filters ...orm if iOpen.Valid { issue.Open = iOpen.Bool } - nwe.Issue = &issue + entry.Issue = &issue } // populate pull if present @@ -247,10 +247,10 @@ func GetNotificationsWithEntities(e Execer, page pagination.Page, filters ...orm 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 index e5256923..a8da391b 100644 --- a/appview/db/pulls.go +++ b/appview/db/pulls.go @@ -487,11 +487,11 @@ func GetPullComments(e Execer, filters ...orm.Filter) ([]models.PullComment, err // 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 index d5a13425..0da7d3cf 100644 --- a/appview/indexer/issues/indexer.go +++ b/appview/indexer/issues/indexer.go @@ -48,7 +48,7 @@ func NewIndexer(indexDir string) *Indexer { // 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 @@ func generateIssueIndexMapping() (mapping.IndexMapping, error) { 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 index ed225f7a..beb79e47 100644 --- a/appview/indexer/pulls/indexer.go +++ b/appview/indexer/pulls/indexer.go @@ -47,7 +47,7 @@ func NewIndexer(indexDir string) *Indexer { // 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 @@ func generatePullIndexMapping() (mapping.IndexMapping, error) { 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 index d2aef059..b34fade4 100644 --- a/appview/indexer/repos/indexer.go +++ b/appview/indexer/repos/indexer.go @@ -51,7 +51,7 @@ func NewIndexer(indexDir string) *Indexer { // 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 @@ func generateRepoIndexMapping() (mapping.IndexMapping, error) { 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 index e8d85ae4..eee1c438 100644 --- a/appview/ingester.go +++ b/appview/ingester.go @@ -818,7 +818,7 @@ func (i *Ingester) ingestKnot(e *jmodels.Event) error { 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 @@ func (i *Ingester) ingestLabelOp(e *jmodels.Event) error { } 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 index 7b98dd9c..34bdcb0d 100644 --- a/appview/issues/issues.go +++ b/appview/issues/issues.go @@ -602,7 +602,7 @@ func (rp *Issues) EditIssueComment(w http.ResponseWriter, r *http.Request) { _, 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 index dab18290..4f266ca2 100644 --- a/appview/knots/knots.go +++ b/appview/knots/knots.go @@ -97,7 +97,7 @@ func (k *Knots) dashboard(w http.ResponseWriter, r *http.Request) { 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 @@ func (k *Knots) delete(w http.ResponseWriter, r *http.Request) { 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 @@ func (k *Knots) retry(w http.ResponseWriter, r *http.Request) { 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 @@ func (k *Knots) retry(w http.ResponseWriter, r *http.Request) { 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 @@ func (k *Knots) addMember(w http.ResponseWriter, r *http.Request) { 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 @@ func (k *Knots) removeMember(w http.ResponseWriter, r *http.Request) { 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 index f76f50b8..74906314 100644 --- a/appview/middleware/middleware.go +++ b/appview/middleware/middleware.go @@ -124,7 +124,7 @@ func (mw Middleware) knotRoleMiddleware(group string) middlewareFunc { 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 @@ func (mw Middleware) knotRoleMiddleware(group string) middlewareFunc { 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 @@ func (mw Middleware) RepoPermissionMiddleware(requiredPerm string) middlewareFun 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 @@ func (mw Middleware) RepoPermissionMiddleware(requiredPerm string) middlewareFun 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 @@ func (mw Middleware) ResolveIssue(next http.Handler) http.Handler { // 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 index e35281b2..57b2e747 100644 --- a/appview/models/notifications.go +++ b/appview/models/notifications.go @@ -104,7 +104,7 @@ func (prefs *NotificationPreferences) ShouldNotify(t NotificationType) bool { 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 index 97788196..1eba8507 100644 --- a/appview/pages/markup/reference_link.go +++ b/appview/pages/markup/reference_link.go @@ -16,7 +16,7 @@ import ( // 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 index 3d251e42..6cd98733 100644 --- a/appview/pages/pages.go +++ b/appview/pages/pages.go @@ -52,7 +52,7 @@ type Pages struct { } 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 index a90f9c4f..9600818f 100644 --- a/appview/pages/templates/repo/pipelines/workflow.html +++ b/appview/pages/templates/repo/pipelines/workflow.html @@ -12,7 +12,7 @@ {{ block "sidebar" . }} {{ end }}