Skip to content

Remove douplicate code from Resource / NestedResource #17

@Ninigi

Description

@Ninigi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueEasy to fix issue, does not need a lot of experience to be able to contributehelp wanted

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions