AdRoll / rebar3_hank

The Erlang Dead Code Cleaner
MIT License
68 stars 9 forks source link

[single_use_hrl_files] Can't ignore a warning #67

Closed elbrujohalcon closed 3 years ago

elbrujohalcon commented 3 years ago

Describe the bug I'm trying to analyze erlmld with Hank. The project includes a module that's autogenerated by the GPB plugin. That auto-generated module has this line: -include("gpb.hrl").. That file (gpb.hrl) is actually in ./_build/default/plugins/gpb/include, which is not in the list of files analyzed by Hank. I tried to ignore the warnings in the auto-generated module, but I couldn't get rid of this line…

gpb.hrl:0: This header file is only included at: src/kpl_agg_pb.erl

To Reproduce AdRoll/erlmld#29

Expected behavior There must be a way to ignore the gpb.hrl:0 warning.

rebar3 logs

===> Load global config file /Users/fernandobenavides/.config/rebar3/rebar.config
===> 22.3.4.11 satisfies the requirement for minimum OTP version 22
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> 22.3.4.11 satisfies the requirement for minimum OTP version 21
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> 22.3.4.11 satisfies the requirement for minimum OTP version 22
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> 22.3.4.11 satisfies the requirement for minimum OTP version 18
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> 22.3.4.11 satisfies the requirement for minimum OTP version 19.3
===> Evaluating config script "/Users/fernandobenavides/Projects/NextRoll/erlmld/_build/default/plugins/gpb/rebar.config.script"
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> Expanded command sequence to be run: [app_discovery,hank]
===> Running provider: app_discovery
===> Found top-level apps: [erlmld]
    using config: [{src_dirs,["src"]},{lib_dirs,["apps/*","lib/*","."]}]
===> Evaluating config script "/Users/fernandobenavides/Projects/NextRoll/erlmld/_build/default/lib/erlexec/rebar.config.script"
===> Evaluating config script "/Users/fernandobenavides/Projects/NextRoll/erlmld/_build/default/lib/jiffy/rebar.config.script"
===> 22.3.4.11 satisfies the requirement for minimum OTP version 19.3
===> Evaluating config script "/Users/fernandobenavides/Projects/NextRoll/erlmld/_build/default/plugins/gpb/rebar.config.script"
===> Setting paths to [deps]
===> Compile (apps)
===> Setting paths to [plugins]
===> Setting paths to [deps]
===> Setting paths to [plugins]
===> Setting paths to [plugins]
===> Not adding provider protobuf compile from module rebar3_gpb_prv_compile because it already exists from module rebar3_gpb_prv_compile
===> Not adding provider protobuf clean from module rebar3_gpb_prv_clean because it already exists from module rebar3_gpb_prv_clean
===> Running provider: hank
===> Looking for code to kill with fire...
===> Hank rules: [single_use_hrl_attrs,single_use_hrls,unused_hrls,
                         unused_ignored_function_params,unused_macros,
                         unused_record_fields]
===> Hank Context: #{app_dirs =>
                                #{erlmld =>
                                      "/Users/fernandobenavides/Projects/NextRoll/erlmld"}}
===> Hank will use 14 files for anlysis: ["include/erlmld.hrl",
                                                 "include/kpl_agg_pb.hrl",
                                                 "src/erlmld_app.erl",
                                                 "src/erlmld_batch_processor.erl",
                                                 "src/erlmld_flusher.erl",
                                                 "src/erlmld_noisy_wrk.erl",
                                                 "src/erlmld_runner.erl",
                                                 "src/erlmld_sup.erl",
                                                 "src/erlmld_tcp_acceptor.erl",
                                                 "src/erlmld_worker.erl",
                                                 "src/erlmld_wrk_statem.erl",
                                                 "src/erlmld_wrk_sup.erl",
                                                 "src/kpl_agg.erl",
                                                 "src/kpl_agg_pb.erl"]
===> Hank ignored 32 warnings
===> The following pieces of code are dead and should be removed:
src/kpl_agg.erl:156: Param #1 is not used at create_explicit_hash_key/1
gpb.hrl:0: This header file is only included at: src/kpl_agg_pb.erl