-
Notifications
You must be signed in to change notification settings - Fork 4
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
base: master
Are you sure you want to change the base?
Add typespecs #11
Conversation
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} |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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} |
There was a problem hiding this comment.
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]>
Include and extend #10.