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

New failure in 'adaptalint' #1997

Closed
MichaelChirico opened this issue Jul 3, 2023 · 5 comments · Fixed by #1998
Closed

New failure in 'adaptalint' #1997

MichaelChirico opened this issue Jul 3, 2023 · 5 comments · Fixed by #1998
Labels
regression code that used to work, but now doesn't

Comments

@MichaelChirico
Copy link
Collaborator

Haven't had time to explore yet, but there's a new failure in the 'adaptalint' test suite [v3.0.2 vs current HEAD]:

── Error (test-basics.R:29:3): extract works in simple case ────────────────────
<tibble_error_column_names_cannot_be_empty/tibble_error/rlang_error/error/condition>
Error in `as_tibble(.)`: Columns 1, 2, 3, 4, 5, and 18 more must be named.
Use `.name_repair` to specify repair.
Caused by error in `repaired_names()`:
! Names can't be empty.
✖ Empty names found at locations 1, 2, 3, 4, 5, etc.

It's a simple test of adaptalint::extract_style(); that function looks like:

filename %>%
  lint() %>%
  as_tibble() %>%
  mutate(total_lints = n()) %>%
  group_by(.data$linter) %>%
  summarise(count = n(),
            total_lints = mean(.data$total_lints)
  ) %>%
  mutate(adjusted = .data$count/.data$total_lints)

The first thing that comes to mind is the new S3 dispatch... we might need to add an as_tibble.lints method, perhaps?

@MichaelChirico MichaelChirico added the regression code that used to work, but now doesn't label Jul 3, 2023
@MichaelChirico MichaelChirico added this to the 3.1.0 milestone Jul 3, 2023
@MichaelChirico
Copy link
Collaborator Author

MichaelChirico commented Jul 3, 2023

Yep... here's the MRE:

tibble::as_tibble(lintr::lint(text="a=1", linters=lintr::assignment_linter()))

I think we get to use an Enhances dependency, so that's fun :) Scratch that, we already Suggest tibble :(

@AshesITR
Copy link
Collaborator

AshesITR commented Jul 3, 2023

Why doesn't tibble:::as_tibble.default get dispatched and return a good tibble using lintr:::as.data.frame.lints?

> tibble::as_tibble(lintr::lint(text="a=1", linters=lintr::assignment_linter()))
# A tibble: 1 × 7
  filename line_number column_number type  message                        line  linter           
  <chr>          <dbl>         <dbl> <chr> <chr>                          <chr> <chr>            
1 <text>             1             2 style Use <-, not =, for assignment. a=1   assignment_linter
> getRversion()
[1] ‘4.3.1’

@MichaelChirico
Copy link
Collaborator Author

that's what used to happen, now as_tibble.list intercedes

@MichaelChirico
Copy link
Collaborator Author

Maybe there's a tibble version consideration here too?

@AshesITR
Copy link
Collaborator

AshesITR commented Jul 3, 2023

Ah that makes sense. Can we export an S3 method without importing tibble?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression code that used to work, but now doesn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants