Skip to content

Add typespecs#11

Open
Annopaolo wants to merge 2 commits into
secomind:masterfrom
Annopaolo:add_typespec
Open

Add typespecs#11
Annopaolo wants to merge 2 commits into
secomind:masterfrom
Annopaolo:add_typespec

Conversation

@Annopaolo
Copy link
Copy Markdown

Include and extend #10.

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 12, 2021

Coverage Status

Coverage remained the same at 77.174% when pulling 71a0f64 on Annopaolo:add_typespec into 98dc50b on ispirata:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-1.6%) to 75.532% when pulling 522a6c9 on Annopaolo:add_typespec into 98dc50b on ispirata:master.

@Annopaolo Annopaolo marked this pull request as ready for review March 12, 2021 15:21
Comment thread lib/cfxxl.ex Outdated
defp process_response({:error, _} = response), do: response
defp process_response({:ok, %HTTPoison.Response{body: body}}), do: extract_result(body)

@spec extract_result(iodata) :: {:error, any} | {:ok, any}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swap :ok and :error clauses for consistency

Comment thread lib/cfxxl.ex Outdated
@scan_opts [:ip, :timeout, :family, :scanner]
@sign_opts [:hosts, :subject, :serial_sequence, :label, :profile, :bundle]

@spec authsign(CFXXL.Client.t(), String.t(), String.t(), keyword) :: {:ok, any} | {:error, any}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General style guideline: we always use parentheses after types in typespecs, so: keyword(), any() and so on, please fix it everywhere

Comment thread lib/cfxxl.ex Outdated

def certinfo(_client, _opts), do: {:error, :no_certificate_or_domain}

@spec crl(CFXXL.Client.t(), any) :: {:ok, any} | {:error, any}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to be specific with input arguments when you can deduce more specific types from the contex and/or from the doc. For example here you could use:

   @spec crl(CFXXL.Client.t(), String.t() | nil) :: {:ok, any} | {:error, any}

Signed-off-by: Arnaldo Cesco <arnaldo.cesco@ispirata.com>
Signed-off-by: Annopaolo <arnaldo.cesco@gmail.com>
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 this pull request may close these issues.

3 participants