Skip to content

Commit

Permalink
Deprecate everything we're removing in 1.0
Browse files Browse the repository at this point in the history
This adds deprecation warnings to all the things we'll be removing when
1.0 is released. We can probably release this as version 0.99 to make it
clear that this is just a release that adds deprecations before 1.0.
  • Loading branch information
devonestes committed Nov 23, 2018
1 parent d9761b0 commit 19c49c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/benchee.ex
Expand Up @@ -44,6 +44,11 @@ for {module, moduledoc} <- [{Benchee, elixir_doc}, {:benchee, erlang_doc}] do
end

def run(config, jobs) when is_map(jobs) do
IO.puts("""
Passing configuration as the first argument to `run/2` is deprecated.
Please see the documentation for `run/2` for updated usage instructions.
""")

# pre 0.6.0 way of passing in the config first and as a map
do_run(jobs, config)
end
Expand Down
8 changes: 8 additions & 0 deletions lib/benchee/configuration.ex
Expand Up @@ -347,6 +347,14 @@ defmodule Benchee.Configuration do

defp formatter_configuration_from_options(config, module, legacy_option_key) do
if Map.has_key?(config.formatter_options, legacy_option_key) do
IO.puts("""
Using `:formatter_options` to configure formatters is now deprecated.
Please see the documentation for `Benchee.Configuration.init/1` for
current usage instructions.
""")

{module, config.formatter_options[legacy_option_key]}
else
module
Expand Down
15 changes: 14 additions & 1 deletion lib/benchee/formatter.ex
Expand Up @@ -73,7 +73,20 @@ defmodule Benchee.Formatter do
{formatter, @default_opts}
end

defp normalize_module_configuration(formatter), do: formatter
defp normalize_module_configuration(formatter) when is_function(formatter, 1), do: formatter

defp normalize_module_configuration(formatter) do
IO.puts("""
All formaters that are not modules implementing the `Benchee.Formatter`
behaviour or functions with an arity of 1 are deprecated.
Please see the documentation for `Benchee.Configuration.init/1` for
current usage instructions.
""")

formatter
end

defp is_formatter_module?({formatter, _options}) when is_atom(formatter) do
module_attributes = formatter.module_info(:attributes)
Expand Down

0 comments on commit 19c49c0

Please sign in to comment.