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

Add typespecs #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add typespecs #11

wants to merge 2 commits into from

Conversation

Annopaolo
Copy link

Include and extend #10.

@coveralls
Copy link

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

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
lib/cfxxl.ex Outdated
@@ -426,6 +443,7 @@ defmodule CFXXL do
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
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

lib/cfxxl.ex Outdated
@@ -36,6 +36,7 @@ defmodule CFXXL do
@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
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

lib/cfxxl.ex Outdated
@@ -161,6 +164,7 @@ defmodule CFXXL do

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

@spec crl(CFXXL.Client.t(), any) :: {:ok, any} | {:error, any}
Copy link
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 <[email protected]>
Signed-off-by: Annopaolo <[email protected]>
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