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

FieldDefinitions cop doesn't work on module interfaces #110

Closed
eapache-opslevel opened this issue Feb 10, 2023 · 2 comments · Fixed by #112
Closed

FieldDefinitions cop doesn't work on module interfaces #110

eapache-opslevel opened this issue Feb 10, 2023 · 2 comments · Fixed by #112

Comments

@eapache-opslevel
Copy link

eapache-opslevel commented Feb 10, 2023

# frozen_string_literal: true

module Types
  module SomeInterfaceType
    include Types::BaseInterface

    field :field_one, String, null: false
    field :field_two, String, null: true

    def field_one
      # do something
    end

    def field_two
      # do something else
    end
  end
end

with

GraphQL/FieldDefinitions:
  Enabled: true
  EnforcedStyle: define_resolver_after_definition

Produces no warnings or diffs, presumably because it's only looking for classes that inherit from GraphQL::Schema::Object, and not modules?

cc @ravangen @toneymathews I think you've been looking at this cop recently, not sure if you have any insight? Also, hi, hope everything is good!

cc @exterm

@DmitryTsepelev
Copy link
Owner

Hey @eapache-opslevel!

Fixed in #112, the problem was that this cop was not considered modules at all. Please let me know if it does not help.

@eapache-opslevel
Copy link
Author

Thanks for the quick response. Our config uses define_resolver_after_definition, so the PR doesn't help since it only runs if the style is group_definitions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants