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

build: Ban extra elses #366

Merged
merged 5 commits into from
Apr 20, 2022
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
5 changes: 2 additions & 3 deletions query/graphql/schema/descriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,10 @@ func (g *Generator) CreateDescriptions(
if _, exists := desc.GetField(fname); exists {
// lets make sure its an _id field, otherwise
// we might have an error here
if strings.HasSuffix(fname, "_id") {
continue
} else {
if !strings.HasSuffix(fname, "_id") {
return nil, fmt.Errorf("Error: found a duplicate field '%s' for type %s", fname, t.Name())
}
continue
}

fd := client.FieldDescription{
Expand Down
7 changes: 3 additions & 4 deletions query/graphql/schema/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ func (g *Generator) expandInputArgument(obj *gql.Object) error {
case *gql.Object:
if _, complete := g.expandedFields[fieldKey]; complete {
continue
} else {
g.expandedFields[fieldKey] = true
}
g.expandedFields[fieldKey] = true

// make sure all the sub fields are expanded first
if err := g.expandInputArgument(t); err != nil {
return err
Expand All @@ -242,9 +242,8 @@ func (g *Generator) expandInputArgument(obj *gql.Object) error {
listType := t.OfType
if _, complete := g.expandedFields[fieldKey]; complete {
continue
} else {
g.expandedFields[fieldKey] = true
}
g.expandedFields[fieldKey] = true

if listObjType, ok := listType.(*gql.Object); ok {
if err := g.expandInputArgument(listObjType); err != nil {
Expand Down
12 changes: 3 additions & 9 deletions tools/configs/golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ linters:
- errcheck
- forbidigo
- lll
- revive
# - wrapcheck
# - errorlint
# - gci
Expand Down Expand Up @@ -653,15 +654,8 @@ linters-settings:
ignore-generated-header: true
severity: warning
rules:
- name: indent-error-flow
severity: warning
- name: add-constant
severity: warning
arguments:
- maxLitCount: "3"
allowStrs: '""'
allowInts: "0,1,2"
allowFloats: "0.0,0.,1.0,1.,2.0,2."
- name: superfluous-else
severity: error

staticcheck:
# Select the Go version to target. The default is '1.13'.
Expand Down