Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[skip changelog] Remove spurious argument from error message #1827

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

Merged
per1234 merged 1 commit into arduino:master from per1234:fix-error-message
Aug 9, 2022
Merged

[skip changelog] Remove spurious argument from error message #1827

per1234 merged 1 commit into arduino:master from per1234:fix-error-message
Aug 9, 2022

Conversation

Copy link
Contributor

@per1234 per1234 commented Aug 8, 2022
edited
Loading

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • [N/A] Docs have been added / updated (for bug fixes / features)
  • [N/A] UPGRADING.md has been updated with a migration guide (for breaking changes)

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

github.com/arduino/arduino-cli/i18n.Tr provides a fmt.Printf-style interface, where the first argument may serve as a template filled by subsequent arguments according to its format verbs.

The call modified in this PR contains a subsequent argument, but no verb in the format string to use it. This generates some cryptic content in the error message.

For example:

Error during install: Error downloading tool arduino:bossac@1.7.0-arduino3: no versions available for the current OS%!(EXTRA *cores.ToolRelease=arduino:bossac@1.7.0-arduino3)

(note the unexpected %!(EXTRA *cores.ToolRelease=arduino:bossac@1.7.0-arduino3))

What is the new behavior?

The cryptic content is not present in the error message:

For example:

Error during install: Error downloading tool arduino:bossac@1.7.0-arduino3: no versions available for the current OS

The tool name is already provided in the correctly configured Message field of the error, so there is no need to include it in the Cause field as well, so the spurious argument can be removed entirely rather than the alternative fix of adjusting the format string argument. I suspect the spurious argument was simply the result of a copy/paste error.

Does this PR introduce a breaking change?

No breaking change

`github.com/arduino/arduino-cli/i18n.Tr` provides a `fmt.Printf`-style interface, where the first argument may serve as
a template filled by subsequent arguments according to its format verbs.
This call contains a subsequent argument, but no verb in the format string to use it. This generates some cryptic
content in the error message.
For example:
Error during install: Error downloading tool arduino:bossac@1.7.0-arduino3: no versions available for the current OS%!(EXTRA *cores.ToolRelease=arduino:bossac@1.7.0-arduino3)
The tool name is already provided in the correctly configured `Message` field of the error, so there is no need to
include it in the `Cause` field as well, so the spurious argument can be removed entirely rather than the alternative
fix of adjusting the format string argument. I suspect the spurious argument was simply the result of a copy/paste error.
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Aug 8, 2022
@per1234 per1234 self-assigned this Aug 8, 2022
Copy link

codecov bot commented Aug 8, 2022

Codecov Report

Merging #1827 (1a61693) into master (c7163b7) will not change coverage.
The diff coverage is 0.00%.

@@ Coverage Diff @@
## master #1827 +/- ##
=======================================
 Coverage 35.86% 35.86% 
=======================================
 Files 231 231 
 Lines 19324 19324 
=======================================
 Hits 6930 6930 
 Misses 11569 11569 
 Partials 825 825 
Flag Coverage Δ
unit 35.86% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
arduino/cores/packagemanager/download.go 22.89% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Member

cmaglie commented Aug 9, 2022

I think that there is a way to let golint to detect this kind of errors (i.e. tell the linter that tr is a printf style function and check that the arguments match the format string), but I never investigated how.

per1234 reacted with thumbs up emoji

@per1234 per1234 merged commit 9075512 into arduino:master Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@cmaglie cmaglie cmaglie approved these changes

@umbynos umbynos Awaiting requested review from umbynos

@MatteoPologruto MatteoPologruto Awaiting requested review from MatteoPologruto

Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /