View Source unused_configuration_options (rebar3_hank v1.4.1)

A rule to detect unused configuration options It will find options that are no longer used around the code: - All the options from the *.config files (excepting rebar.config, elvis.config and relx.config) - The env list inside any *.app.src files

To avoid this warning, remove the unused parameters.

note

Note

For this rule to apply, it's assumed that configuration options for an Erlang application are only consumed within said Erlang application or the other applications in the same umbrella project. If you have a dependency that consumes an environment parameter from one of your project applications, you can add an ignore rule in rebar.config for it.

Link to this section Summary

Functions

Detects unused config options. It gets the options from .config and .app.src files and then:
  1. Builds an index with file/options.
  2. Gets the atoms used around the .erl and .hrl files.
  3. Calculates the unused atoms (options) and return the results.
Rule ignore specifications. Only valid in rebar.config since attributes are not allowed in config files. Example:
       {hank, [{ignore, [
           {"this_file.config", unused_configuration_options, [ignore_option]}
       ]}]}.
       

Link to this section Functions

Link to this function

analyze(FilesAndASTs, Context)

View Source
-spec analyze(hank_rule:asts(), hank_context:t()) -> [hank_rule:result()].
Detects unused config options. It gets the options from .config and .app.src files and then:
  1. Builds an index with file/options.
  2. Gets the atoms used around the .erl and .hrl files.
  3. Calculates the unused atoms (options) and return the results.
-spec ignored(hank_rule:ignore_pattern(), term()) -> boolean().
Rule ignore specifications. Only valid in rebar.config since attributes are not allowed in config files. Example:
       {hank, [{ignore, [
           {"this_file.config", unused_configuration_options, [ignore_option]}
       ]}]}.