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

Remove douplicate code from Resource / NestedResource #17

Open
Ninigi opened this issue Mar 14, 2018 · 0 comments
Open

Remove douplicate code from Resource / NestedResource #17

Ninigi opened this issue Mar 14, 2018 · 0 comments
Labels
good first issue Easy to fix issue, does not need a lot of experience to be able to contribute help wanted

Comments

@Ninigi
Copy link
Collaborator

Ninigi commented Mar 14, 2018

Because we are defining singular_resource, plural_resource and to_json in both modules, linters will warn you about "functions can not match because a previous function will always match"

defmodule Shopify.Variant do
  @derive [Poison.Encoder]
  @singular "variant"
  @plural "variants"

  use Shopify.Resource, import: [
    :find
  ]

  # This will trigger warnings:
  use Shopify.NestedResource, import: [
    :create,
    :all,
    :count,
    :update,
    :delete
  ]
  # ...
end

One way to solve this would be to move to_json and the resource functions in respective modules.

@Ninigi Ninigi added help wanted good first issue Easy to fix issue, does not need a lot of experience to be able to contribute labels Mar 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Easy to fix issue, does not need a lot of experience to be able to contribute help wanted
Projects
None yet
Development

No branches or pull requests

1 participant