-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error messages from io:format
and related functions
#8611
Conversation
CT Test Results 2 files 95 suites 36m 7s ⏱️ Results for commit 4c6a99f. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
I was hoping this PR would arrive soon :) Would you mind expanding the tests in https://github.com/erlang/otp/blob/OTP-27.0/lib/stdlib/test/io_SUITE.erl#L3125-L3138 and https://github.com/erlang/otp/blob/OTP-27.0/lib/stdlib/test/erl_lint_SUITE.erl#L3820-L3827 (https://github.com/erlang/otp/blob/OTP-27.0/lib/stdlib/test/erl_lint_SUITE_data/format.erl) ? |
😅
Sure, but I probably won't get to it today. |
b9f03a2
to
e31bb92
Compare
@garazdawi added some tests as requested, please take a look. |
Looks good and test seem to pass. If you rebase to maint I will merge it for inclusion in 27.1. |
d8edf1b
to
4c6a99f
Compare
@garazdawi done, squashed the commits and rebased/retargeted to |
thanks! |
Fixes #8568.
This PR introduces a new function
erl_lint:check_format_string/2
, where the second argument can be used to decide if the check should be strict (true
, the default) or relaxed (false
).Strict checking, which is the same as in the current implementation, will check and complain about repeated (eg
~ttp
), conflicting (eg~kKp
) or non-applicable (eg~kb
) modifiers in formatting sequences. Those do not cause errors, though, so while it is ok for linting to check and warn about them, it will cause wrong error messages.Relaxed checking omits the above checks and only reports erroneous format sequences (eg
~q
). Relaxed checking is used byerl_stdlib_errors
to print out error reasons.