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

Switch to warning/1 with updated build matrix #495

Merged
merged 8 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
[
inputs: [
"*.exs",
"config/*.exs",
"lib/**/*.ex",
"priv/**/*.exs",
"scripts/*.exs",
"test/**/*.{ex,exs}"
],
inputs: ["{mix,.formatter}.exs", "{lib,test}/**/*.{ex,exs}"],
import_deps: [],
locals_without_parens: []
]
10 changes: 5 additions & 5 deletions .github/workflows/elixir.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
matrix:
include:
- pair:
elixir: '1.10'
elixir: '1.11'
otp: '21.3'
- pair:
elixir: '1.12'
otp: '24.0'
elixir: '1.15'
otp: '26.0'
lint: lint

runs-on: ubuntu-20.04
Expand All @@ -43,7 +43,7 @@ jobs:
restore-keys: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-mix-

- name: Run mix deps.get
run: mix deps.get --only test
run: mix deps.ci

- name: Run mix format
run: mix format --check-formatted
Expand All @@ -57,4 +57,4 @@ jobs:
if: ${{ matrix.lint }}

- name: Run tests
run: mix test
run: mix test.ci
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Elixir Plug, Logger and client for the :zap: [Honeybadger error notifier](https:

### Version Requirements

- Erlang >= 18.0
- Elixir >= 1.10
- Erlang >= 21.0
- Elixir >= 1.11
- Plug >= 1.0
- Phoenix >= 1.0 (This is an optional dependency and the version requirement applies only if you are using Phoenix)

Expand Down
3 changes: 0 additions & 3 deletions config/config.exs

This file was deleted.

3 changes: 0 additions & 3 deletions config/dev.exs

This file was deleted.

10 changes: 0 additions & 10 deletions config/test.exs

This file was deleted.

30 changes: 0 additions & 30 deletions dummy/mixapp/config/config.exs

This file was deleted.

2 changes: 0 additions & 2 deletions dummy/mixapp/lib/mixapp.ex

This file was deleted.

13 changes: 1 addition & 12 deletions dummy/mixapp/lib/mixapp/application.ex
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
defmodule Mixapp.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false

use Application

def start(_type, _args) do
# List all child processes to be supervised
children = [
# Starts a worker by calling: Mixapp.Worker.start_link(arg)
# {Mixapp.Worker, arg},
]

# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Mixapp.Supervisor]
Supervisor.start_link(children, opts)
Supervisor.start_link([], strategy: :one_for_one, name: Mixapp.Supervisor)
end
end
13 changes: 7 additions & 6 deletions dummy/mixapp/mix.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
%{
"certifi": {:hex, :certifi, "2.0.0", "a0c0e475107135f76b8c1d5bc7efb33cd3815cb3cf3dea7aefdd174dabead064", [:rebar3], [], "hexpm", "fdc6066ceeccb3aa14049ab6edf0b9af3b64ae1b0db2a92d5c52146f373bbb1c"},
"hackney": {:hex, :hackney, "1.10.1", "c38d0ca52ea80254936a32c45bb7eb414e7a96a521b4ce76d00a69753b157f21", [:rebar3], [{:certifi, "2.0.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "6b1980a33628824ec829239b6f9bfc455f60eebc19d3096a215f5f6170d675cf"},
"idna": {:hex, :idna, "5.1.0", "d72b4effeb324ad5da3cab1767cb16b17939004e789d8c0ad5b70f3cea20c89a", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fc1a2f7340c422650504b1662f28fdf381f34cbd30664e8491744e52c9511d40"},
"certifi": {:hex, :certifi, "2.12.0", "2d1cca2ec95f59643862af91f001478c9863c2ac9cb6e2f89780bfd8de987329", [:rebar3], [], "hexpm", "ee68d85df22e554040cdb4be100f33873ac6051387baf6a8f6ce82272340ff1c"},
"hackney": {:hex, :hackney, "1.20.1", "8d97aec62ddddd757d128bfd1df6c5861093419f8f7a4223823537bad5d064e2", [:rebar3], [{:certifi, "~> 2.12.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~> 6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~> 1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~> 1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.4.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~> 1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "fe9094e5f1a2a2c0a7d10918fee36bfec0ec2a979994cff8cfe8058cd9af38e3"},
"idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~> 0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"},
"jason": {:hex, :jason, "1.0.0", "0f7cfa9bdb23fed721ec05419bcee2b2c21a77e926bce0deda029b5adc716fe2", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b96c400e04b7b765c0854c05a4966323e90c0d11fee0483b1567cda079abb205"},
"metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"},
"mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [], [], "hexpm"},
"mimerl": {:hex, :mimerl, "1.0.2", "993f9b0e084083405ed8252b99460c4f0563e41729ab42d9074fd5e52439be88", [:rebar3], [], "hexpm", "7a4c8e1115a2732a67d7624e28cf6c9f30c66711a9e92928e745c255887ba465"},
"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},
"parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"},
"plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"},
"poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.1", "28a4d65b7f59893bc2c7de786dec1e1555bd742d336043fe644ae956c3497fbe", [:make, :rebar], [], "hexpm", "4f8805eb5c8a939cf2359367cb651a3180b27dfb48444846be2613d79355d65e"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.7", "354c321cf377240c7b8716899e182ce4890c5938111a1296add3ec74cf1715df", [:make, :mix, :rebar3], [], "hexpm", "fe4c190e8f37401d30167c8c405eda19469f34577987c76dde613e838bbc67f8"},
"telemetry": {:hex, :telemetry, "0.4.0", "8339bee3fa8b91cb84d14c2935f8ecf399ccd87301ad6da6b71c09553834b2ab", [:rebar3], [], "hexpm", "e9e3cacfd37c1531c0ca70ca7c0c30ce2dbb02998a4f7719de180fe63f8d41e4"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.3.1", "a1f612a7b512638634a603c8f401892afbf99b8ce93a45041f8aaca99cadb85e", [:rebar3], [], "hexpm", "da1d9bef8a092cc7e1e51f1298037a5ddfb0f657fe862dfe7ba4c5807b551c29"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"},
}
12 changes: 6 additions & 6 deletions lib/honeybadger/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ defmodule Honeybadger.Client do
if pid = Process.whereis(__MODULE__) do
GenServer.cast(pid, {:notice, notice})
else
Logger.warn(fn ->
Logger.warning(fn ->
"[Honeybadger] Unable to notify, the :honeybadger client isn't running"
end)
end
Expand Down Expand Up @@ -139,10 +139,10 @@ defmodule Honeybadger.Client do
post_notice(url, headers, payload, hackney_opts)

{:error, %Jason.EncodeError{message: message}} ->
Logger.warn(fn -> "[Honeybadger] Notice encoding failed: #{message}" end)
Logger.warning(fn -> "[Honeybadger] Notice encoding failed: #{message}" end)

{:error, %Protocol.UndefinedError{description: message}} ->
Logger.warn(fn -> "[Honeybadger] Notice encoding failed: #{message}" end)
Logger.warning(fn -> "[Honeybadger] Notice encoding failed: #{message}" end)
end

{:noreply, state}
Expand All @@ -169,14 +169,14 @@ defmodule Honeybadger.Client do

{:ok, code, _headers, ref} when code == 429 ->
body = body_from_ref(ref)
Logger.warn(fn -> "[Honeybadger] API failure: #{inspect(body)}" end)
Logger.warning(fn -> "[Honeybadger] API failure: #{inspect(body)}" end)

{:ok, code, _headers, ref} when code in 400..599 ->
body = body_from_ref(ref)
Logger.warn(fn -> "[Honeybadger] API failure: #{inspect(body)}" end)
Logger.warning(fn -> "[Honeybadger] API failure: #{inspect(body)}" end)

{:error, reason} ->
Logger.warn(fn -> "[Honeybadger] connection error: #{inspect(reason)}" end)
Logger.warning(fn -> "[Honeybadger] connection error: #{inspect(reason)}" end)
end
end

Expand Down
19 changes: 17 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ defmodule Honeybadger.Mixfile do
[
app: :honeybadger,
version: @version,
elixir: "~> 1.7",
elixir: "~> 1.11",
consolidate_protocols: Mix.env() != :test,
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
elixirc_paths: elixirc_paths(Mix.env()),
preferred_cli_env: ["test.ci": :test],

# Hex
package: package(),
Expand Down Expand Up @@ -51,7 +53,7 @@ defmodule Honeybadger.Mixfile do

def application do
[
applications: [:hackney, :logger, :jason, :telemetry],
extra_applications: [:logger],
env: [
api_key: {:system, "HONEYBADGER_API_KEY"},
app: nil,
Expand Down Expand Up @@ -108,4 +110,17 @@ defmodule Honeybadger.Mixfile do
}
]
end

defp aliases do
[
"deps.ci": [
"deps.get --only test",
"cmd --cd dummy/mixapp mix deps.get --only test"
],
"test.ci": [
"test --raise",
"cmd --cd dummy/mixapp mix test --raise"
]
]
end
end
4 changes: 2 additions & 2 deletions test/honeybadger/backtrace_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ defmodule Honeybadger.BacktraceTest do
stacktrace = [
{:erlang, :some_func, [{:ok, 123}], []},
{Honeybadger, :notify, [%RuntimeError{message: "error"}, %{a: 1}, [:a, :b]],
[file: 'lib/honeybadger.ex', line: 38]},
[file: ~c"lib/honeybadger.ex", line: 38]},
{Honeybadger.Backtrace, :from_stacktrace, 1,
[file: 'lib/honeybadger/backtrace.ex', line: 4, error_info: %{module: :erl_erts_errors}]}
[file: ~c"lib/honeybadger/backtrace.ex", line: 4, error_info: %{module: :erl_erts_errors}]}
]

with_config([filter_args: false], fn ->
Expand Down
9 changes: 2 additions & 7 deletions test/honeybadger/breadcrumbs/collector_test.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
defmodule Honeybadger.Breadcrumbs.CollectorTest do
use Honeybadger.Case, async: true
use Honeybadger.Case

alias Honeybadger.Breadcrumbs.{Collector, Breadcrumb}

Expand All @@ -13,12 +13,7 @@ defmodule Honeybadger.Breadcrumbs.CollectorTest do
end

test "runs metadata through sanitizer" do
bc1 =
Breadcrumb.new("test1",
metadata: %{
key1: %{key2: 12}
}
)
bc1 = Breadcrumb.new("test1", metadata: %{key1: %{key2: 12}})

Collector.add(bc1)

Expand Down
2 changes: 1 addition & 1 deletion test/honeybadger/json_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ defmodule Honeybadger.JSONTest do
|> Notice.new(%{context: %{a: map, b: [map], c: [map, map]}}, [])
|> Jason.encode()

assert custom_encoded == jason_encoded
assert Jason.decode!(custom_encoded) == Jason.decode!(jason_encoded)
end

test "handles values requring inspection" do
Expand Down
2 changes: 1 addition & 1 deletion test/honeybadger/notice_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmodule Honeybadger.NoticeTest do
}

metadata = %{plug_env: plug_env, tags: [:test], context: %{user_id: 1, account_id: 1}}
stack = [{Kernel, :+, [1], [file: 'lib/elixir/lib/kernel.ex', line: 321]}]
stack = [{Kernel, :+, [1], [file: ~c"lib/elixir/lib/kernel.ex", line: 321]}]

notice = Notice.new(exception, metadata, stack)

Expand Down
18 changes: 0 additions & 18 deletions test/integration_test.exs

This file was deleted.

12 changes: 12 additions & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
Logger.remove_backend(:console)

Application.put_all_env(
ex_unit: [
assert_receive_timeout: 400,
refute_receive_timeout: 200
],
honeybadger: [
environment_name: :test,
api_key: "abc123",
origin: "http://localhost:4444"
]
)

ExUnit.start(assert_receive_timeout: 1000, refute_receive_timeout: 1000)

defmodule Honeybadger.Case do
Expand Down
Loading