Skip to content
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

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

juhlig
Copy link
Contributor

@juhlig juhlig commented Jun 24, 2024

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 by erl_stdlib_errors to print out error reasons.

Copy link
Contributor

github-actions bot commented Jun 24, 2024

CT Test Results

    2 files     95 suites   36m 7s ⏱️
2 142 tests 2 094 ✅ 48 💤 0 ❌
2 451 runs  2 401 ✅ 50 💤 0 ❌

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

@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jun 24, 2024
@juhlig
Copy link
Contributor Author

juhlig commented Jun 24, 2024

@juhlig juhlig force-pushed the fix_io_format_error_messages branch from b9f03a2 to e31bb92 Compare June 24, 2024 13:03
@juhlig
Copy link
Contributor Author

juhlig commented Jun 24, 2024

@garazdawi added some tests as requested, please take a look.

@garazdawi garazdawi added the testing currently being tested, tag is used by OTP internal CI label Jun 24, 2024
@garazdawi
Copy link
Contributor

Looks good and test seem to pass. If you rebase to maint I will merge it for inclusion in 27.1.

@garazdawi garazdawi added this to the OTP-27.1 milestone Jun 25, 2024
@juhlig juhlig force-pushed the fix_io_format_error_messages branch from d8edf1b to 4c6a99f Compare June 25, 2024 09:08
@juhlig juhlig changed the base branch from master to maint June 25, 2024 09:08
@juhlig
Copy link
Contributor Author

juhlig commented Jun 25, 2024

@garazdawi done, squashed the commits and rebased/retargeted to maint 👍

@garazdawi garazdawi merged commit d2b82ae into erlang:maint Jun 25, 2024
16 checks passed
@garazdawi
Copy link
Contributor

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect error messages from io:format and related functions
3 participants