Skip to content

Commit

Permalink
Fix false positive in MissedMetadataKeyInLoggerConfig
Browse files Browse the repository at this point in the history
Refs #1101
  • Loading branch information
rrrene committed Jan 5, 2024
1 parent 16b47de commit 484f24c
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions lib/credo/check/warning/missed_metadata_key_in_logger_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,13 @@ defmodule Credo.Check.Warning.MissedMetadataKeyInLoggerConfig do
metadata_keys = Params.get(params, :metadata_keys, __MODULE__)

if metadata_keys == [] do
find_metadata_keys_in_logger_config() || []
find_metadata_keys_in_logger_config(:default_formatter) ||
find_metadata_keys_in_logger_config(:console) || []
else
metadata_keys
end
end

if Version.match?(System.version(), ">= 1.15.0-rc") do
defp find_metadata_keys_in_logger_config(),
do: find_metadata_keys_in_logger_config(:default_formatter)
else
defp find_metadata_keys_in_logger_config(),
do: find_metadata_keys_in_logger_config(:console)
end

defp find_metadata_keys_in_logger_config(key) do
:logger
|> Application.get_env(key, [])
Expand Down

0 comments on commit 484f24c

Please sign in to comment.