From ed97456a2bc9b8c7e4277e354e3a3b269e42ecb2 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Sun, 14 Jun 2020 12:28:08 -0700 Subject: [PATCH] [printf] document CHECKERS_PRINTF_ARGS Summary: As per title. Reviewed By: jvillard Differential Revision: D22019654 fbshipit-source-id: 70c2fcd10 --- infer/documentation/issues/CHECKERS_PRINTF_ARGS.md | 9 +++++++++ infer/src/base/IssueType.ml | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 infer/documentation/issues/CHECKERS_PRINTF_ARGS.md diff --git a/infer/documentation/issues/CHECKERS_PRINTF_ARGS.md b/infer/documentation/issues/CHECKERS_PRINTF_ARGS.md new file mode 100644 index 000000000..24654d5ae --- /dev/null +++ b/infer/documentation/issues/CHECKERS_PRINTF_ARGS.md @@ -0,0 +1,9 @@ +This error is reported when the argument types to a `printf` method do not match the format string. + +```java + void stringInsteadOfInteger(PrintStream out) { + out.printf("Hello %d", "world"); + } +``` + +Action: fix the mismatch between format string and argument types. diff --git a/infer/src/base/IssueType.ml b/infer/src/base/IssueType.ml index b3257c7b1..90e56b2dd 100644 --- a/infer/src/base/IssueType.ml +++ b/infer/src/base/IssueType.ml @@ -324,7 +324,10 @@ let checkers_immutable_cast = ~user_documentation:[%blob "../../documentation/issues/CHECKERS_IMMUTABLE_CAST.md"] -let checkers_printf_args = register_from_string ~id:"CHECKERS_PRINTF_ARGS" Error PrintfArgs +let checkers_printf_args = + register_from_string ~id:"CHECKERS_PRINTF_ARGS" Error PrintfArgs + ~user_documentation:[%blob "../../documentation/issues/CHECKERS_PRINTF_ARGS.md"] + let class_cast_exception = register_from_string ~visibility:Developer ~enabled:false ~id:"CLASS_CAST_EXCEPTION" Error