-
Notifications
You must be signed in to change notification settings - Fork 186
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
Print a message when no lints found #2643
Conversation
Windows failures seem spurious: > checking top-level files ... NOTE
Non-standard file/directory found at top level:
'install.ps1' |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2643 +/- ##
=======================================
Coverage 97.96% 97.96%
=======================================
Files 126 126
Lines 5760 5761 +1
=======================================
+ Hits 5643 5644 +1
Misses 117 117 ☔ View full report in Codecov by Sentry. |
rstudio_source_markers(x) | ||
} else { | ||
# Empty lints | ||
cli_inform(c(i = "No lints found.")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a classed signal:
class(tryCatch(cli::cli_inform("xxx"), condition=identity))
# [1] "rlang_message" "message" "condition"
Is that appropriate? I might have expected just cat()
here, I guess {cli} adds nice aesthetics -- are there any analogues for "plain text to terminal"? cli::cli_text(c(i = "No lints found."))
drops the i
formatting.
(or perhaps a message is appropriate, WDYT?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message seems ok to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we could use cat()
, but I also think there are benefits to having this as a classed signal over cat()
(e.g. the messages will show up in logs).
If we don't want a classed signal, either cli_alert()
or its sibling should work:
cli::cli_alert_success("No lints found")
#> ✔ No lints found
class(tryCatch(cli::cli_alert_success("No lints found"), condition=identity))
#> [1] "cli_message" "condition"
Created on 2024-08-05 with reprex v2.1.1
So we can have our pretty aesthetics cake and eat it too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The Windows failure looks like it needs reporting as a bug to r-lib/actions.
Done: r-lib/actions#898 |
Still waver a bit on whether signalling a condition is really the right thing to do for code that's performing fine, in fact congratulatory. But, I don't think it actually matters -- we are a "front end" package & I can't think of any scenario where the difference between |
Closes #2640
Created on 2024-08-04 with reprex v2.1.1