diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cfff80ef9..ebb35dad5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,18 @@ on: - 'doc/**' jobs: + typos-check: + name: Spell Check with Typos + runs-on: ubuntu-latest + steps: + - name: Checkout Actions Repository + uses: actions/checkout@v3 + - name: Check spelling with custom config file + uses: crate-ci/typos@v1.13.10 + with: + config: .github/workflows/typos.toml + + lint: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/typos.toml b/.github/workflows/typos.toml new file mode 100644 index 000000000..c25ebe164 --- /dev/null +++ b/.github/workflows/typos.toml @@ -0,0 +1,12 @@ +# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos +[default.extend-words] +ba = "ba" +importent = "importent" +mis = "mis" +nd = "nd" +ons = "ons" +ser = "ser" +ue = "ue" +[files] +extend-exclude = [] + diff --git a/dialect/gremlin/config.go b/dialect/gremlin/config.go index a578173e3..a5bbc0a5d 100644 --- a/dialect/gremlin/config.go +++ b/dialect/gremlin/config.go @@ -25,7 +25,7 @@ type ( httpClient *http.Client } - // Endpoint wraps a url to add flag unmarshaling. + // Endpoint wraps a url to add flag unmarshalling. Endpoint struct { *url.URL } diff --git a/dialect/gremlin/graph/edge.go b/dialect/gremlin/graph/edge.go index b2343609a..02f4b475a 100644 --- a/dialect/gremlin/graph/edge.go +++ b/dialect/gremlin/graph/edge.go @@ -56,7 +56,7 @@ func (e Edge) MarshalGraphson() ([]byte, error) { func (e *Edge) UnmarshalGraphson(data []byte) error { var edge edge if err := graphson.Unmarshal(data, &edge); err != nil { - return fmt.Errorf("unmarshaling edge: %w", err) + return fmt.Errorf("unmarshalling edge: %w", err) } *e = NewEdge( diff --git a/dialect/gremlin/request_test.go b/dialect/gremlin/request_test.go index e3b929cf6..6622224b8 100644 --- a/dialect/gremlin/request_test.go +++ b/dialect/gremlin/request_test.go @@ -119,7 +119,7 @@ func TestCredentialsBadEncodingMarshaling(t *testing.T) { text: []byte("Kg=="), }, { - name: "NoSeperator", + name: "NoSeparator", text: []byte("AHVzZXI="), }, } diff --git a/dialect/sql/builder.go b/dialect/sql/builder.go index 92779d2d0..9e1452f79 100644 --- a/dialect/sql/builder.go +++ b/dialect/sql/builder.go @@ -140,7 +140,7 @@ func (t *TableBuilder) Column(c *ColumnBuilder) *TableBuilder { return t } -// Columns appends the a list of columns to the builder. +// Columns appends a list of columns to the builder. func (t *TableBuilder) Columns(columns ...*ColumnBuilder) *TableBuilder { t.columns = make([]Querier, 0, len(columns)) for i := range columns { @@ -195,7 +195,7 @@ func (t *TableBuilder) Collate(s string) *TableBuilder { return t } -// Options appends additional options to to the statement (MySQL only). +// Options appends additional options to the statement (MySQL only). func (t *TableBuilder) Options(s string) *TableBuilder { t.options = s return t @@ -484,7 +484,7 @@ type ReferenceBuilder struct { columns []string // referenced columns. } -// Reference create a reference builder for the reference_option clause. +// Reference creates a reference builder for the reference_option clause. // // Reference().Table("groups").Columns("id") func Reference() *ReferenceBuilder { return &ReferenceBuilder{} } @@ -2095,7 +2095,7 @@ func (s *SelectTable) Columns(columns ...string) []string { } // Unquote makes the table name to be formatted as raw string (unquoted). -// It is useful whe you don't want to query tables under the current database. +// It is useful when you don't want to query tables under the current database. // For example: "INFORMATION_SCHEMA.TABLE_CONSTRAINTS" in MySQL. func (s *SelectTable) Unquote() *SelectTable { s.quote = false @@ -2254,7 +2254,7 @@ func (s *Selector) SelectedColumns() []string { return columns } -// UnqualifiedColumns returns the an unqualified version of the +// UnqualifiedColumns returns an unqualified version of the // selected columns in the Selector. e.g. "t1"."c" => "c". func (s *Selector) UnqualifiedColumns() []string { columns := make([]string, 0, len(s.selection)) @@ -3130,7 +3130,7 @@ type WindowBuilder struct { } // RowNumber returns a new window clause with the ROW_NUMBER() as a function. -// Using this function will assign a each row a number, from 1 to N, in the +// Using this function will assign each row a number, from 1 to N, in the // order defined by the ORDER BY clause in the window spec. func RowNumber() *WindowBuilder { return Window(func(b *Builder) { @@ -3493,7 +3493,7 @@ type ( } // ParamFormatter wraps the FormatPram function. ParamFormatter interface { - // The FormatParam function lets users to define + // The FormatParam function lets users define // custom placeholder formatting for their types. // For example, formatting the default placeholder // from '?' to 'ST_GeomFromWKB(?)' for MySQL dialect. diff --git a/dialect/sql/schema/postgres.go b/dialect/sql/schema/postgres.go index 2b31ac484..b778b2e5f 100644 --- a/dialect/sql/schema/postgres.go +++ b/dialect/sql/schema/postgres.go @@ -817,7 +817,7 @@ func (d *Postgres) atIndex(idx1 *Index, t2 *schema.Table, idx2 *schema.Index) er if v, ok := opc[c1.Name]; ok { var op postgres.IndexOpClass if err := op.UnmarshalText([]byte(v)); err != nil { - return fmt.Errorf("unmarshaling operator-class %q for column %q: %v", v, c1.Name, err) + return fmt.Errorf("unmarshalling operator-class %q for column %q: %v", v, c1.Name, err) } part.Attrs = append(part.Attrs, &op) } diff --git a/dialect/sql/sqlgraph/graph.go b/dialect/sql/sqlgraph/graph.go index 76fb2c4a4..23b957539 100644 --- a/dialect/sql/sqlgraph/graph.go +++ b/dialect/sql/sqlgraph/graph.go @@ -1313,7 +1313,7 @@ func (c *batchCreator) nodes(ctx context.Context, drv dialect.Driver) error { // If the ID value was provided to one of the nodes, it should be // provided to all others because this affects the way we calculate // their values in MySQL and SQLite dialects. - return fmt.Errorf("incosistent id values for batch insert") + return fmt.Errorf("inconsistent id values for batch insert") } // Assign NULL values for empty placeholders. values[i][column] = nil diff --git a/doc/md/tutorial-grpc-edges.md b/doc/md/tutorial-grpc-edges.md index 4574e2bb1..b05bf3f95 100644 --- a/doc/md/tutorial-grpc-edges.md +++ b/doc/md/tutorial-grpc-edges.md @@ -93,13 +93,13 @@ Observe the following changes: * A new message, `Category` was created. This message has a field named `admin` corresponding to the `admin` edge on the `Category` schema. It is a non-repeated field because we set the edge to be `.Unique()`. It's field number is `3`, corresponding to the `entproto.Field` annotation on the edge definition. -* A new field `administered` was added to the `User` message definition. It is a `repeated` field, correspending to the +* A new field `administered` was added to the `User` message definition. It is a `repeated` field, corresponding to the fact that we did not mark the edge as `Unique` in this direction. It's field number is `5`, corresponding to the `entproto.Field` annotation on the edge. ### Creating Entities with their Edges -Let's demonstrate how to create an entity with it's edges by writing a test: +Let's demonstrate how to create an entity with its edges by writing a test: ```go package main diff --git a/doc/md/versioned-migrations.mdx b/doc/md/versioned-migrations.mdx index 01a22d941..a8e555fb5 100644 --- a/doc/md/versioned-migrations.mdx +++ b/doc/md/versioned-migrations.mdx @@ -678,7 +678,7 @@ Counter Initialization** header) and re-calculated on startup by looking at the you happen to have a table with no rows yet, the autoincrement starting value is set to 0 for every table without any entries. With the online migration feature this wasn't an issue, because the migration engine looked at the `ent_types` tables and made sure to update the counter, if it wasn't set correctly. However, with versioned migration, this is no -longer the case. In oder to ensure, that everything is set up correctly after a server restart, make sure to call +longer the case. In order to ensure, that everything is set up correctly after a server restart, make sure to call the `VerifyTableRange` method on the Atlas struct: ```go @@ -862,7 +862,7 @@ generation, use the `schema.DisableChecksum()` option. In addition to the usual `.sql` migration files the migration directory will contain the `atlas.sum` file. Every time you let Ent generate a new migration file, this file is updated for you. However, every manual change made to the -mitration directory will render the migration directory and the `atlas.sum` file out-of-sync. With the Atlas CLI you can +migration directory will render the migration directory and the `atlas.sum` file out-of-sync. With the Atlas CLI you can both check if the file and migration directory are in-sync, and fix it if not: ```shell diff --git a/doc/website/blog/2021-03-12-announcing-edge-field-support.md b/doc/website/blog/2021-03-12-announcing-edge-field-support.md index f625f69e8..25714ec0d 100644 --- a/doc/website/blog/2021-03-12-announcing-edge-field-support.md +++ b/doc/website/blog/2021-03-12-announcing-edge-field-support.md @@ -116,7 +116,7 @@ func (Pet) Fields() []ent.Field { return []ent.Field{ field.String("name"). NotEmpty(), - field.Int("owner_id"), // <-- explictly add the field we want to contain the FK + field.Int("owner_id"), // <-- explicitly add the field we want to contain the FK } } diff --git a/doc/website/blog/2022-01-04-serverless-graphql-using-aws.md b/doc/website/blog/2022-01-04-serverless-graphql-using-aws.md index 9652c6198..1de7b842e 100644 --- a/doc/website/blog/2022-01-04-serverless-graphql-using-aws.md +++ b/doc/website/blog/2022-01-04-serverless-graphql-using-aws.md @@ -29,7 +29,7 @@ The landing page of the AppSync service should render you a "Create API" button,
Screenshot of getting started with AWS AppSync from scratch -

Getting started from sratch with AWS AppSync

+

Getting started from scratch with AWS AppSync

In the top panel reading "Customize your API or import from Amazon DynamoDB" select the option "Build from scratch" and click the "Start" button belonging to the panel. @@ -134,7 +134,7 @@ Second, we add an environment the variable `DATABASE_URL` encoding the database
Screenshot of AWS Lambda landing page listing functions -

AWS Lambda environemnt variables settings of Ent function.

+

AWS Lambda environment variables settings of Ent function.

To open a connection to the database, pass in a [DSN](https://en.wikipedia.org/wiki/Data_source_name), e.g., `postgres://username:password@hostname/dbname`. @@ -396,7 +396,7 @@ import ( ) func main() { - // open the daatabase connection using the pgx driver + // open the database connection using the pgx driver db, err := sql.Open("pgx", os.Getenv("DATABASE_URL")) if err != nil { log.Fatalf("failed opening database connection: %v", err) @@ -406,7 +406,7 @@ func main() { client := ent.NewClient(ent.Driver(entsql.OpenDB(dialect.Postgres, db))) defer client.Close() - // register our event handler to lissten on Lambda events + // register our event handler to listen on Lambda events lambda.Start(handler.New(client).Handle) } ``` diff --git a/doc/website/blog/2023-02-23-simple-cms-with-ent.mdx b/doc/website/blog/2023-02-23-simple-cms-with-ent.mdx index 6ce077a92..df7afbd89 100644 --- a/doc/website/blog/2023-02-23-simple-cms-with-ent.mdx +++ b/doc/website/blog/2023-02-23-simple-cms-with-ent.mdx @@ -65,7 +65,7 @@ Some of Ent's most cited features are: management tool with many advanced capabilities. Atlas can automatically plan schema migrations for you as well as verify them in CI or deploy them to production for you. (Full disclosure: Ariel and I are the creators and maintainers) -#### Prerequisities +#### Prerequisites * [Install Go](https://go.dev/doc/install) * [Install Docker](https://docs.docker.com/get-docker/) @@ -700,7 +700,7 @@ We can now run our application and stand amazed at our achievement: a working bl You can follow the changes in this step in [this commit](https://github.com/rotemtam/ent-blog-example/commit/2e412ab2cda0fd251ccb512099b802174d917511). ::: -No content mangement system would be complete without the ability, well, to manage content. Let's demonstrate how we can add support for publishing new posts on our blog. +No content management system would be complete without the ability, well, to manage content. Let's demonstrate how we can add support for publishing new posts on our blog. Let's start by creating the backend handler: ```go diff --git a/entc/gen/template/builder/query.tmpl b/entc/gen/template/builder/query.tmpl index 7709cfe74..1194ec241 100644 --- a/entc/gen/template/builder/query.tmpl +++ b/entc/gen/template/builder/query.tmpl @@ -414,7 +414,7 @@ func ({{ $receiver }} *{{ $builder }}) prepareQuery(ctx context.Context) error { {{ xtemplate $tmpl . }} {{ end }} -{{- /* Support adding query methods by global templates. In order to generate dialect-sepcific methods, +{{- /* Support adding query methods by global templates. In order to generate dialect-specific methods, prefix this template with "dialect/{{ .Storage }}". For example: "dialect/sql/query/additional/*". */}} {{- with $tmpls := matchTemplate "query/additional/*" }} {{- range $tmpl := $tmpls }} diff --git a/entc/gen/template/dialect/gremlin/predicate.tmpl b/entc/gen/template/dialect/gremlin/predicate.tmpl index c1e213929..64980652a 100644 --- a/entc/gen/template/dialect/gremlin/predicate.tmpl +++ b/entc/gen/template/dialect/gremlin/predicate.tmpl @@ -55,7 +55,7 @@ in the LICENSE file in the root directory of this source tree. {{- $direction := "Out" -}} {{- if $e.IsInverse -}} {{- $direction = "In" -}} - {{/* avoid circular dependecies */}} + {{/* avoid circular dependencies */}} {{- $label = $e.InverseLabelConstant -}} {{- end -}} func(t *dsl.Traversal) { @@ -76,7 +76,7 @@ in the LICENSE file in the root directory of this source tree. {{- if $e.IsInverse -}} {{- $direction = "In" -}} {{- $inverse_direction = "Out" -}} - {{/* avoid circular dependecies */}} + {{/* avoid circular dependencies */}} {{- $label = $e.InverseLabelConstant -}} {{- end -}} func(t *dsl.Traversal) { diff --git a/entc/gen/template/dialect/sql/feature/schemaconfig.tmpl b/entc/gen/template/dialect/sql/feature/schemaconfig.tmpl index 34ee356f5..0019fc8c6 100644 --- a/entc/gen/template/dialect/sql/feature/schemaconfig.tmpl +++ b/entc/gen/template/dialect/sql/feature/schemaconfig.tmpl @@ -41,14 +41,14 @@ func NewSchemaConfigContext(parent context.Context, config SchemaConfig) context {{- end }} -{{/* Addtional imports by the schemaconfig feature. */}} +{{/* Additional imports by the schemaconfig feature. */}} {{- define "dialect/sql/import/additional/schemaconfig" -}} {{- if $.FeatureEnabled "sql/schemaconfig" }} "{{ $.Config.Package }}/internal" {{- end }} {{- end }} -{{/* Addtional fields to the config struct. */}} +{{/* Additional fields to the config struct. */}} {{- define "dialect/sql/config/fields/schemaconfig" -}} {{- if $.FeatureEnabled "sql/schemaconfig" -}} // schemaConfig contains alternative names for all tables. @@ -56,7 +56,7 @@ func NewSchemaConfigContext(parent context.Context, config SchemaConfig) context {{- end }} {{- end -}} -{{/* Addtional top-level code for the generated config.go file. */}} +{{/* Additional top-level code for the generated config.go file. */}} {{- define "dialect/sql/config/options/schemaconfig" }} {{- if $.FeatureEnabled "sql/schemaconfig" }} // SchemaConfig represents alternative schema names for all tables diff --git a/entc/gen/template/import.tmpl b/entc/gen/template/import.tmpl index 416671436..3232ff0be 100644 --- a/entc/gen/template/import.tmpl +++ b/entc/gen/template/import.tmpl @@ -14,7 +14,7 @@ import ( "math" "strings" "time" - {{- /* Ignore generting on graph templates (e.g. config.tmpl, client.tmpl, etc). */}} + {{- /* Ignore generating on graph templates (e.g. config.tmpl, client.tmpl, etc). */}} {{- if ne $.Config.Package $.Package }} "{{ $.Config.Package }}/predicate" {{- if $.HasOneFieldID }} diff --git a/entc/gen/template/migrate/schema.tmpl b/entc/gen/template/migrate/schema.tmpl index 8c117abae..88cd00348 100644 --- a/entc/gen/template/migrate/schema.tmpl +++ b/entc/gen/template/migrate/schema.tmpl @@ -80,7 +80,7 @@ var ( {{- end }} {{- end }} }, - {{- /* postpone refrencing to avoid typechecking loops */}} + {{- /* postpone referencing to avoid typechecking loops */}} RefColumns: []*schema.Column{ {{- range $c1 := $fk.RefColumns }} {{- range $i, $c2 := $fk.RefTable.Columns }} diff --git a/entc/integration/compose/gremlin-server/Dockerfile b/entc/integration/compose/gremlin-server/Dockerfile index 01cb73674..ccbcf8321 100644 --- a/entc/integration/compose/gremlin-server/Dockerfile +++ b/entc/integration/compose/gremlin-server/Dockerfile @@ -7,5 +7,5 @@ # https://docs.aws.amazon.com/neptune/latest/userguide/engine-releases-1.0.5.0.html FROM tinkerpop/gremlin-server:3.4.11 -# Copy overriden server configuration. +# Copy overridden server configuration. COPY gremlin-server.yaml tinkergraph-empty.properties /opt/gremlin-server/conf/ diff --git a/entc/integration/customid/ent/schema/accout.go b/entc/integration/customid/ent/schema/account.go similarity index 100% rename from entc/integration/customid/ent/schema/accout.go rename to entc/integration/customid/ent/schema/account.go diff --git a/entc/integration/customid/ent/schema/session.go b/entc/integration/customid/ent/schema/session.go index 635283ae1..e9bba454c 100644 --- a/entc/integration/customid/ent/schema/session.go +++ b/entc/integration/customid/ent/schema/session.go @@ -82,7 +82,7 @@ func (i *ID) Scan(v any) error { case string: copy(i[:], v) default: - return fmt.Errorf("unexpcted type: %T", v) + return fmt.Errorf("unexpected type: %T", v) } return nil } diff --git a/entc/integration/ent/schema/fieldtype.go b/entc/integration/ent/schema/fieldtype.go index f6d9c4029..7ca26242d 100644 --- a/entc/integration/ent/schema/fieldtype.go +++ b/entc/integration/ent/schema/fieldtype.go @@ -342,7 +342,7 @@ func (s *Strings) scan(v string) error { return nil } if l := len(v); l < 2 || v[0] != '{' && v[l-1] != '}' { - return fmt.Errorf("unexpcted array format %q", v) + return fmt.Errorf("unexpected array format %q", v) } *s = strings.Split(v[1:len(v)-1], ",") return nil diff --git a/examples/privacytenant/ent/template/privacy.tmpl b/examples/privacytenant/ent/template/privacy.tmpl index fae6f54b8..d208007a4 100644 --- a/examples/privacytenant/ent/template/privacy.tmpl +++ b/examples/privacytenant/ent/template/privacy.tmpl @@ -1,7 +1,7 @@ {{/* The line below tells Intellij/GoLand to enable the autocompletion based on the *gen.Graph type. */}} {{/* gotype: entgo.io/ent/entc/gen.Graph */}} -{{/* An example privacy rule that is appeneded to the generated privacy package. For more info: https://entgo.io/docs/privacy#template-based */}} +{{/* An example privacy rule that is appended to the generated privacy package. For more info: https://entgo.io/docs/privacy#template-based */}} {{ define "privacy/additional/privacy" }} // FilterTenantRule is a query/mutation rule that filters out entities that are not in the tenant. func FilterTenantRule() QueryMutationRule {