Skip to content

Commit

Permalink
Fix credo warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
drowzy committed Jan 25, 2022
1 parent f0d6b79 commit 1d6e1e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/k8s/selector.ex
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ defmodule K8s.Selector do
def field(fields) when is_map(fields),
do: field_selector_from_map(fields, "=")

@spec field(map(), {binary | atom, binary}) :: t()
def field(%{} = selector_or_operation, field),
do: merge(selector_or_operation, field(field), :field)

Expand All @@ -253,6 +254,7 @@ defmodule K8s.Selector do

def field_not(fields) when is_map(fields), do: field_selector_from_map(fields, "!=")

@spec field_not(map(), {binary | atom, binary}) :: t()
def field_not(%{} = selector_or_operation, field),
do: merge(selector_or_operation, field_not(field), :field)

Expand Down Expand Up @@ -359,7 +361,6 @@ defmodule K8s.Selector do
Operation.put_label_selector(op, merged_selector)
end

@spec merge(selector_or_operation_t, t, atom) :: selector_or_operation_t
defp merge(%Operation{} = op, %__MODULE__{} = next, :field) do
prev = Operation.get_field_selector(op)
merged_selector = merge(prev, next, :label)
Expand Down Expand Up @@ -552,6 +553,7 @@ defmodule K8s.Selector do

defp serialize_match_expression(%{"operator" => "DoesNotExist", "key" => key}), do: "!#{key}"

@spec field_selector_from_map(map(), String.t()) :: t()
defp field_selector_from_map(fields, op) do
match_fields =
fields
Expand Down

0 comments on commit 1d6e1e9

Please sign in to comment.