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.
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.
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.
AshesITR
left a comment
There was a problem hiding this comment.
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