[config] Fail on unknown options from .inferconfig when in strict mode

Summary: Extend INFER_STRICT_MODE from deprecated arguments to invalid argument in .inferconfig file

Reviewed By: jvillard

Differential Revision: D4455231

fbshipit-source-id: 5ec4670
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent 65eb3a176d
commit ebc4c6fd53

@ -533,7 +533,7 @@ let decode_inferconfig_to_argv current_exe path =
| Ok json -> | Ok json ->
json json
| Error msg -> | Error msg ->
F.eprintf "WARNING: Could not read or parse Infer config in %s:@\n%s@." path msg ; warnf "WARNING: Could not read or parse Infer config in %s:@\n%s@." path msg ;
`Assoc [] in `Assoc [] in
let desc_list = !(IList.assoc equal_exe current_exe exe_desc_lists) in let desc_list = !(IList.assoc equal_exe current_exe exe_desc_lists) in
let json_config = YBU.to_assoc json in let json_config = YBU.to_assoc json in
@ -548,10 +548,10 @@ let decode_inferconfig_to_argv current_exe path =
decode_json json_val @ result decode_json json_val @ result
with with
| Not_found -> | Not_found ->
F.eprintf "WARNING: while reading config file %s:@\nUnknown option %s@." path key ; warnf "WARNING: while reading config file %s:@\nUnknown option %s@." path key ;
result result
| YBU.Type_error (msg, json) -> | YBU.Type_error (msg, json) ->
F.eprintf "WARNING: while reading config file %s:@\nIll-formed value %s for option %s: %s@." warnf "WARNING: while reading config file %s:@\nIll-formed value %s for option %s: %s@."
path (Yojson.Basic.to_string json) key msg ; path (Yojson.Basic.to_string json) key msg ;
result in result in
IList.fold_left one_config_item [] json_config IList.fold_left one_config_item [] json_config
@ -565,7 +565,7 @@ let encode_argv_to_env argv =
(IList.filter (fun arg -> (IList.filter (fun arg ->
not (String.contains arg env_var_sep) not (String.contains arg env_var_sep)
|| ( || (
F.eprintf "Ignoring unsupported option containing '%c' character: %s@\n" warnf "Ignoring unsupported option containing '%c' character: %s@\n"
env_var_sep arg ; env_var_sep arg ;
false false
) )

Loading…
Cancel
Save