Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup empty switch cases #3733

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: lint-commit-or-rollback ./backend/... 2>&1 | to-annotation
- name: go-check-sumtype
shell: bash
run: go-check-sumtype ./backend/... ./cmd/... ./internal/... 2>&1 | to-annotation
run: go-check-sumtype --include-shared-interfaces=true ./backend/... ./cmd/... ./internal/... 2>&1 | to-annotation
- name: actionlint
shell: bash
run: actionlint --oneline | to-annotation
Expand Down
12 changes: 3 additions & 9 deletions internal/schema/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,9 @@ func (d *Data) Monomorphise(ref *Ref) (*Data, error) {
}
n.Type = t

case *Any, *Bool, *Bytes, *Data, *Ref, *Database, Decl, *Float,
IngressPathComponent, *IngressPathLiteral, *IngressPathParameter,
*Int, Metadata, *MetadataCalls, *MetadataConfig, *MetadataDatabases, *MetadataRetry,
*MetadataIngress, *MetadataCronJob, *MetadataAlias, *MetadataSecrets, *Module,
*Schema, *String, *Time, Type, *TypeParameter, *Unit, *Verb, *Enum,
*EnumVariant, Value, *IntValue, *StringValue, *TypeValue, Symbol,
Named, *TypeAlias, *Topic, *MetadataSubscriber, *MetadataTypeMap,
*MetadataEncoding, *MetadataPublisher, *MetadataSQLMigration, *DSNDatabaseConnector, *DatabaseRuntime,
DatabaseConnector, *AWSIAMAuthDatabaseConnector, *DatabaseRuntimeConnections, *MetadataArtefact, Provisioned:
case Type, Metadata, Value, IngressPathComponent, DatabaseConnector,
*Module, *Schema, *TypeParameter, *Verb, *Enum, *TypeAlias, *Topic, *Database,
*DatabaseRuntimeConnections, *Data, *EnumVariant, *DatabaseRuntime:
}
return next()
})
Expand Down
10 changes: 3 additions & 7 deletions internal/schema/jsonschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,9 @@ func nodeToJSSchema(node Node, refs map[RefKey]*Ref) *jsonschema.Schema {
case *TypeAlias:
return nodeToJSSchema(node.Type, refs)

case Decl, *Field, Metadata, *MetadataCalls, *MetadataConfig, *MetadataDatabases, *MetadataIngress,
*MetadataAlias, *MetadataSecrets, IngressPathComponent, *IngressPathLiteral, *IngressPathParameter, *Module,
*Schema, Type, *Database, *Verb, *EnumVariant, *MetadataCronJob, Value,
*StringValue, *IntValue, *TypeValue, *Config, *Secret, Symbol, Named,
*MetadataRetry, *Topic, *MetadataSubscriber, *MetadataTypeMap,
*MetadataEncoding, *MetadataPublisher, *MetadataSQLMigration, *DSNDatabaseConnector, *DatabaseRuntime,
*AWSIAMAuthDatabaseConnector, DatabaseConnector, *DatabaseRuntimeConnections, *MetadataArtefact, Provisioned:
case Metadata, IngressPathComponent, DatabaseConnector, Type, Value,
*Module, *Field, *Schema, *Database, *Verb, *EnumVariant,
*Config, *Secret, *Topic, *DatabaseRuntime, *DatabaseRuntimeConnections:
panic(fmt.Sprintf("unsupported node type %T", node))

default:
Expand Down
28 changes: 9 additions & 19 deletions internal/schema/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,11 @@ func ValidateModuleInSchema(schema *Schema, m optional.Option[*Module]) (*Schema
}
return next()

case *Array, *Bool, *Bytes, *Data, Decl, *Field, *Float,
IngressPathComponent, *IngressPathLiteral, *IngressPathParameter,
*Int, *Map, Metadata, *MetadataCalls, *MetadataConfig, *MetadataDatabases, *MetadataCronJob,
*MetadataIngress, *MetadataAlias, *MetadataSecrets, *Module, *Optional, *Schema, *TypeAlias,
*String, *Time, Type, *Unit, *Any, *TypeParameter, *EnumVariant, *MetadataRetry,
Value, *IntValue, *StringValue, *TypeValue, *Config, *Secret, Symbol, Named,
*MetadataSubscriber, *Topic, *MetadataTypeMap, *MetadataEncoding, *MetadataPublisher,
*MetadataSQLMigration, *DSNDatabaseConnector, *DatabaseRuntime, DatabaseConnector,
*AWSIAMAuthDatabaseConnector, *DatabaseRuntimeConnections, *MetadataArtefact, Provisioned:
case
IngressPathComponent, Metadata, Value, Type, DatabaseConnector,
*Module, *Optional, *Schema, *TypeAlias, *String, *Time, *Unit, *Any, *TypeParameter,
*EnumVariant, *Config, *Secret, *Topic, *DatabaseRuntime, *DatabaseRuntimeConnections,
*Data, *Field:
}
return next()
})
Expand Down Expand Up @@ -360,16 +356,10 @@ func ValidateModule(module *Module) error {
n.Catch.Module = module.Name
}

case *Array, *Bool, *Database, *Float, *Int,
*Time, *Map, *Module, *Schema, *String, *Bytes,
*MetadataCalls, *MetadataConfig, *MetadataDatabases, *MetadataIngress, *MetadataCronJob, *MetadataAlias,
*MetadataSecrets, IngressPathComponent, *IngressPathLiteral, *IngressPathParameter, *Optional,
*Unit, *Any, *TypeParameter, *Enum, *EnumVariant, *IntValue, *StringValue, *TypeValue,
*Config, *Secret, *MetadataSubscriber, *MetadataTypeMap, *MetadataEncoding, *MetadataPublisher,
*MetadataSQLMigration, *DSNDatabaseConnector, *DatabaseRuntime, *AWSIAMAuthDatabaseConnector,
*MetadataArtefact, DatabaseConnector, *DatabaseRuntimeConnections, Provisioned:

case Named, Symbol, Type, Metadata, Value, Decl: // Union types.
case Type, Metadata, Value, IngressPathComponent, DatabaseConnector,
*Module, *Schema, *Optional, *TypeParameter, *EnumVariant,
*Config, *Secret, *DatabaseRuntime, *DatabaseRuntimeConnections,
*Database, *Enum:
}
return next()
})
Expand Down
Loading