Skip to content

Provide an easy way to format lint messages with user-specified width #1884

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

Closed
IndrajeetPatil opened this issue Jan 3, 2023 · 1 comment · Fixed by #1885 or #2369
Closed

Provide an easy way to format lint messages with user-specified width #1884

IndrajeetPatil opened this issue Jan 3, 2023 · 1 comment · Fixed by #1885 or #2369
Labels
feature a feature request or enhancement

Comments

@IndrajeetPatil
Copy link
Collaborator

No matter where lint messages are printed (e.g. GitHub annotations, RStudio markers, Markdown in GitHub issues, etc.), currently, there is no straightforward way to print them with a certain width. This means that the user always needs to scroll horizontally to see many of the lint messages.

options(width = 50)
library(lintr)

lint(
  text = "x <- c();",
  linters = unnecessary_concatenation_linter()
)
#> <text>:1:6: style: [unnecessary_concatenation_linter] Unneeded concatenation without arguments. Replace the "c" call by NULL or, whenever possible, vector() seeded with the correct type and/or length.
#> x <- c();
#>      ^~~

Created on 2023-01-03 with reprex v2.0.2

A typical project that starts using linters might throw hundreds of messages, and that's a lot of scrolling. This might be mildly annoying for an able-bodied individual like me, but must be extremely challenging and disappointing for people with mobility impairment. Almost every single lint asks them to scroll to see the full lint message.

We should anticipate this and provide a way out.

@IndrajeetPatil IndrajeetPatil mentioned this issue Jan 19, 2023
5 tasks
@MichaelChirico MichaelChirico added the feature a feature request or enhancement label Aug 8, 2023
@IndrajeetPatil
Copy link
Collaborator Author

With #2369:

options(lintr.format_width = 80)
library(lintr)

lint(
  text = "x <- c();",
  linters = unnecessary_concatenation_linter()
)
#> <text>:1:6: style: [unnecessary_concatenation_linter] Unneeded concatenation
#>     without arguments. Replace the "c" call by NULL or, whenever possible,
#>     vector() seeded with the correct type and/or length.
#> x <- c();
#>      ^~~

Created on 2023-11-30 with reprex v2.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants