make --debug option side-effect free

Summary:
I found it very confusing that running infer with --debug makes the
report to be different.

Intuitively, I expect (and I think majority of users would expect) that
`--debug` makes things more verbose (and potentially more slow / consuming
more memory and disk space), but does not change anything apart from it.

One pro of preserving existing behavior, pointed by jvillard:
- Suppose some check is experimental or disabled in the config. The
users expect the issue to be found, but it does not show up. They run
`infer --debug` to understand the behavior, and suddenly the issue shows
up.

I, hovewer, find this pro not important enough and potentially confusing
the users even more.

(If they want to investigate seriously, they can always use
--no-filtering, and there are a lot of cases when the issue does not
show up for others, much hard to undertand reasons, than the fact that
it is disabled).

Reviewed By: jvillard

Differential Revision: D17113750

fbshipit-source-id: 46cc93503
master
Mitya Lyubarskiy 5 years ago committed by Facebook Github Bot
parent d864fb2c89
commit 753580095e

@ -73,7 +73,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -26,7 +26,7 @@ DESCRIPTION
OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -16,7 +16,7 @@ DESCRIPTION
OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -261,7 +261,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)
See also infer-analyze(1), infer-capture(1), infer-compile(1),

@ -37,7 +37,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -28,7 +28,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -38,7 +38,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)

@ -261,7 +261,7 @@ OPTIONS
--debug,-g
Activates: Debug mode (also sets --debug-level 2,
--developer-mode, --no-filtering, --print-buckets, --print-types,
--developer-mode, --print-buckets, --print-types,
--reports-include-ml-loc, --no-only-cheap-debug, --trace-error,
--write-dotty, --write-html) (Conversely: --no-debug | -G)
See also infer-analyze(1), infer-capture(1), infer-compile(1),

@ -1232,9 +1232,9 @@ and ( biabduction_models_mode
let debug =
CLOpt.mk_bool_group ~deprecated:["debug"; "-stats"] ~long:"debug" ~short:'g'
~in_help:all_generic_manuals
"Debug mode (also sets $(b,--debug-level 2), $(b,--developer-mode), $(b,--no-filtering), \
$(b,--print-buckets), $(b,--print-types), $(b,--reports-include-ml-loc), \
$(b,--no-only-cheap-debug), $(b,--trace-error), $(b,--write-dotty), $(b,--write-html))"
"Debug mode (also sets $(b,--debug-level 2), $(b,--developer-mode), $(b,--print-buckets), \
$(b,--print-types), $(b,--reports-include-ml-loc), $(b,--no-only-cheap-debug), \
$(b,--trace-error), $(b,--write-dotty), $(b,--write-html))"
~f:(fun debug ->
if debug then set_debug_level 2 else set_debug_level 0 ;
CommandLineOption.keep_args_file := debug ;
@ -1246,7 +1246,7 @@ and ( biabduction_models_mode
; trace_error
; write_html
; write_dotty ]
[filtering; only_cheap_debug]
[only_cheap_debug]
and (_ : int option ref) =
CLOpt.mk_int_opt ~long:"debug-level" ~in_help:all_generic_manuals ~meta:"level"
~f:(fun level -> set_debug_level level ; level)

Loading…
Cancel
Save