Skip to content

code quality fixes #128

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

Merged
merged 1 commit into from
Jun 11, 2016
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
4 changes: 2 additions & 2 deletions abstract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
},
},
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Runtime Object type "Human" is not a possible type for "Pet".`,
Locations: []location.SourceLocation{},
},
Expand Down Expand Up @@ -523,7 +523,7 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
},
},
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Runtime Object type "Human" is not a possible type for "Pet".`,
Locations: []location.SourceLocation{},
},
Expand Down
46 changes: 23 additions & 23 deletions definition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,17 +366,17 @@ func TestTypeSystem_DefinitionExample_StringifiesSimpleTypes(t *testing.T) {
expected string
}
tests := []Test{
Test{graphql.Int, "Int"},
Test{blogArticle, "Article"},
Test{interfaceType, "Interface"},
Test{unionType, "Union"},
Test{enumType, "Enum"},
Test{inputObjectType, "InputObject"},
Test{graphql.NewNonNull(graphql.Int), "Int!"},
Test{graphql.NewList(graphql.Int), "[Int]"},
Test{graphql.NewNonNull(graphql.NewList(graphql.Int)), "[Int]!"},
Test{graphql.NewList(graphql.NewNonNull(graphql.Int)), "[Int!]"},
Test{graphql.NewList(graphql.NewList(graphql.Int)), "[[Int]]"},
{graphql.Int, "Int"},
{blogArticle, "Article"},
{interfaceType, "Interface"},
{unionType, "Union"},
{enumType, "Enum"},
{inputObjectType, "InputObject"},
{graphql.NewNonNull(graphql.Int), "Int!"},
{graphql.NewList(graphql.Int), "[Int]"},
{graphql.NewNonNull(graphql.NewList(graphql.Int)), "[Int]!"},
{graphql.NewList(graphql.NewNonNull(graphql.Int)), "[Int!]"},
{graphql.NewList(graphql.NewList(graphql.Int)), "[[Int]]"},
}
for _, test := range tests {
ttypeStr := fmt.Sprintf("%v", test.ttype)
Expand All @@ -392,12 +392,12 @@ func TestTypeSystem_DefinitionExample_IdentifiesInputTypes(t *testing.T) {
expected bool
}
tests := []Test{
Test{graphql.Int, true},
Test{objectType, false},
Test{interfaceType, false},
Test{unionType, false},
Test{enumType, true},
Test{inputObjectType, true},
{graphql.Int, true},
{objectType, false},
{interfaceType, false},
{unionType, false},
{enumType, true},
{inputObjectType, true},
}
for _, test := range tests {
ttypeStr := fmt.Sprintf("%v", test.ttype)
Expand All @@ -419,12 +419,12 @@ func TestTypeSystem_DefinitionExample_IdentifiesOutputTypes(t *testing.T) {
expected bool
}
tests := []Test{
Test{graphql.Int, true},
Test{objectType, true},
Test{interfaceType, true},
Test{unionType, true},
Test{enumType, true},
Test{inputObjectType, false},
{graphql.Int, true},
{objectType, true},
{interfaceType, true},
{unionType, true},
{enumType, true},
{inputObjectType, false},
}
for _, test := range tests {
ttypeStr := fmt.Sprintf("%v", test.ttype)
Expand Down
4 changes: 2 additions & 2 deletions directives.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var IncludeDirective *Directive = NewDirective(&Directive{
Description: "Directs the executor to include this field or fragment only when " +
"the `if` argument is true.",
Args: []*Argument{
&Argument{
{
PrivateName: "if",
Type: NewNonNull(Boolean),
PrivateDescription: "Included when true.",
Expand All @@ -54,7 +54,7 @@ var SkipDirective *Directive = NewDirective(&Directive{
Description: "Directs the executor to skip this field or fragment when the `if` " +
"argument is true.",
Args: []*Argument{
&Argument{
{
PrivateName: "if",
Type: NewNonNull(Boolean),
PrivateDescription: "Skipped when true.",
Expand Down
12 changes: 6 additions & 6 deletions enum_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptStringLiterals(t *testing.T) {
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Argument "fromEnum" expected type "Color" but got: "GREEN".`,
},
},
Expand All @@ -182,7 +182,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptInternalValueInPlaceOfEnumLiteral(t
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Argument "fromEnum" expected type "Color" but got: 1.`,
},
},
Expand All @@ -198,7 +198,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptEnumLiteralInPlaceOfInt(t *testing.T
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Argument "fromInt" expected type "Int" but got: GREEN.`,
},
},
Expand Down Expand Up @@ -248,7 +248,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptInternalValueAsEnumVariable(t *testi
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Variable "$color" expected value of type "Color!" but got: 2.`,
},
},
Expand All @@ -266,7 +266,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptStringVariablesAsEnumInput(t *testin
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Variable "$color" of type "String!" used in position expecting type "Color".`,
},
},
Expand All @@ -284,7 +284,7 @@ func TestTypeSystem_EnumValues_DoesNotAcceptInternalValueVariableAsEnumInput(t *
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Variable "$color" of type "Int!" used in position expecting type "Color".`,
},
},
Expand Down
8 changes: 4 additions & 4 deletions executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func buildExecutionContext(p BuildExecutionCtxParams) (*ExecutionContext, error)
opName := p.OperationName
if opName == "" {
// get first opName
for k, _ := range operations {
for k := range operations {
opName = k
break
}
Expand Down Expand Up @@ -397,10 +397,10 @@ func doesFragmentConditionMatch(eCtx *ExecutionContext, fragment ast.Node, ttype
if conditionalType == ttype {
return true
}
if conditionalType.Name() == ttype.Name() {
if conditionalType.Name() == ttype.Name() {
return true
}

if conditionalType, ok := conditionalType.(Abstract); ok {
return conditionalType.IsPossibleType(ttype)
}
Expand Down Expand Up @@ -739,7 +739,7 @@ func defaultResolveFn(p ResolveParams) (interface{}, error) {
}

/**
* This method looks up the field on the given type defintion.
* This method looks up the field on the given type definition.
* It has special casing for the two introspection fields, __schema
* and __typename. __typename is special because it can always be
* queried as a field, even in situations where no other fields
Expand Down
10 changes: 5 additions & 5 deletions executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,10 +465,10 @@ func TestNullsOutErrorSubtrees(t *testing.T) {
"syncError": nil,
}
expectedErrors := []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: "Error getting syncError",
Locations: []location.SourceLocation{
location.SourceLocation{
{
Line: 3, Column: 7,
},
},
Expand Down Expand Up @@ -619,7 +619,7 @@ func TestThrowsIfNoOperationIsProvidedWithMultipleOperations(t *testing.T) {
}

expectedErrors := []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: "Must provide operation name if query contains multiple operations.",
Locations: []location.SourceLocation{},
},
Expand Down Expand Up @@ -1050,7 +1050,7 @@ func TestFailsWhenAnIsTypeOfCheckIsNotMet(t *testing.T) {
},
},
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Expected value of type "SpecialType" but got: graphql_test.testNotSpecialType.`,
Locations: []location.SourceLocation{},
},
Expand Down Expand Up @@ -1119,7 +1119,7 @@ func TestFailsToExecuteQueryContainingATypeDefinition(t *testing.T) {
expected := &graphql.Result{
Data: nil,
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: "GraphQL cannot execute a request containing a ObjectDefinition",
Locations: []location.SourceLocation{},
},
Expand Down
4 changes: 2 additions & 2 deletions graphql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var Tests = []T{}

func init() {
Tests = []T{
T{
{
Query: `
query HeroNameQuery {
hero {
Expand All @@ -36,7 +36,7 @@ func init() {
},
},
},
T{
{
Query: `
query HeroNameAndFriendsQuery {
hero {
Expand Down
2 changes: 1 addition & 1 deletion introspection.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ mutation operations.`,
Type: __Type,
Description: "Request the type information of a single type.",
Args: []*Argument{
&Argument{
{
PrivateName: "name",
Type: NewNonNull(String),
},
Expand Down
4 changes: 2 additions & 2 deletions introspection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,11 @@ func TestIntrospection_FailsAsExpectedOnThe__TypeRootFieldWithoutAnArg(t *testin
`
expected := &graphql.Result{
Errors: []gqlerrors.FormattedError{
gqlerrors.FormattedError{
{
Message: `Field "__type" argument "name" of type "String!" ` +
`is required but not provided.`,
Locations: []location.SourceLocation{
location.SourceLocation{Line: 3, Column: 9},
{Line: 3, Column: 9},
},
},
},
Expand Down
Loading