Repository navigation
add a series of tests for help completeness - #1023
Conversation
| expect_identical( | ||
| length(gregexpr(linter_item_regex, linter_help_text)[[1L]]), | ||
| nrow(lintr_db), | ||
| info = "Count of linter entries in ?linters matches inst/lintr/linters.csv row count" | ||
| ) |
There was a problem hiding this comment.
Both are sorted, so if we add a capture group for the linter function name, we could use expect_equal() which would provide us with the offending linters. WDYT?
There was a problem hiding this comment.
Seems a bit fragile to me since the sorting is coming from different origins.
How about capture group + sort() here?
There was a problem hiding this comment.
PTAL. hopefully easier to understand with the new approach. And moreover, it already worked -- it caught that the count for consistency_linters is out of date :)
| expect_identical( | ||
| length(gregexpr(tag_item_regex, tag_help_text[[tag]])[[1L]]), | ||
| tag_table[[tag]], | ||
| info = paste0("Count of linter entries in ?", tag, "_linters matches tags given in inst/lintr/linters.csv") | ||
| ) |
| # NB: matching tags requires reproducing the "platform-independent sort" we do; instead, rely on the other tests | ||
| # for matching the tags |
There was a problem hiding this comment.
WDYT about sorting the tags in available_linters()? That would guarantee sortedness (is that even a word?) here and allow rd_tags() to rely on sorted tags. (Could be a separate PR if you want)
There was a problem hiding this comment.
I have kind-of been writing the tags in relevance order, which makes more sense to me than alphabetical. Don't think it makes much sense to over-orient ourselves to making the test easier to write.
capture group + sort in the test would be better.
| ) | ||
|
|
||
| db_tag_table <- as.data.frame( | ||
| table(tag = unlist(lintr_db$tags)), |
There was a problem hiding this comment.
Curious: What will happen if we accidentally provide a tag twice in linters.csv?
Closes #916
The tests themselves are a bit of an ugly/unreadable mess. Hopefully the liberal use of
info=helps out future readers/devs.