Fix dialyzer warnings (#1691)

This commit is contained in:
Jonatan Kłosko 2023-02-03 18:30:41 +01:00 committed by GitHub
parent 5d651cf5c7
commit e622ef4f96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 8 deletions

View file

@ -254,6 +254,8 @@ defmodule Livebook.Application do
end
end
@dialyzer {:no_return, iframe_port_in_use: 1}
defp iframe_port_in_use(port) do
Livebook.Config.abort!(
"Failed to start Livebook iframe server because port #{port} is already in use"

View file

@ -132,7 +132,7 @@ defmodule Livebook.Config do
@doc """
Returns an mfa if there's a way to shut down the system.
"""
@spec shutdown_callback() :: mfa() | nil
@spec shutdown_callback() :: {module(), atom(), list()} | nil
def shutdown_callback() do
Application.fetch_env!(:livebook, :shutdown_callback)
end

View file

@ -13,7 +13,7 @@ defmodule Livebook.Notebook.Cell.Code do
@type t :: %__MODULE__{
id: Cell.id(),
source: String.t(),
source: String.t() | :__pruned__,
outputs: list(Cell.indexed_output()),
disable_formatting: boolean(),
reevaluate_automatically: boolean()

View file

@ -13,7 +13,7 @@ defmodule Livebook.Notebook.Cell.Markdown do
@type t :: %__MODULE__{
id: Cell.id(),
source: String.t()
source: String.t() | :__pruned__
}
@doc """

View file

@ -10,11 +10,11 @@ defmodule Livebook.Notebook.Cell.Smart do
@type t :: %__MODULE__{
id: Cell.id(),
source: String.t(),
source: String.t() | :__pruned__,
chunks: Livebook.Runtime.chunks() | nil,
outputs: list(Cell.indexed_output()),
kind: String.t(),
attrs: attrs(),
kind: String.t() | nil,
attrs: attrs() | :__pruned__,
js_view: Livebook.Runtime.js_view() | nil,
editor: Livebook.Runtime.editor() | nil
}

View file

@ -4,8 +4,8 @@ defmodule Livebook.Settings.EnvVar do
import Ecto.Changeset
@type t :: %__MODULE__{
name: String.t(),
value: String.t()
name: String.t() | nil,
value: String.t() | nil
}
@primary_key {:name, :string, autogenerate: false}

View file

@ -153,6 +153,8 @@ defmodule Livebook.MixProject do
release
end
@compile {:no_warn_undefined, Standalone}
defp standalone_erlang_elixir(release) do
Code.require_file("rel/app/standalone.exs")

View file

@ -2,6 +2,8 @@ defmodule Livebook.TestModules.BadInspect do
defstruct []
defimpl Inspect do
@dialyzer {:nowarn_function, inspect: 2}
def inspect(%Livebook.TestModules.BadInspect{}, _opts) do
:bad_return
end