Skip to content

Commit acb24c3

Browse files
committed
Always tolowercase tags
1 parent 663f0c2 commit acb24c3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

R/buildtools.R

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ get_ostype <- function(path = '.'){
437437
get_schema_keywords <- function(path = '.'){
438438
keywords <- read_description_field(c('X-schema.org-keywords', 'biocViews'), path)
439439
if(length(keywords)){
440-
tolower(trimws(strsplit(keywords, ',', fixed = TRUE)[[1]]))
440+
trimws(strsplit(keywords, ',', fixed = TRUE)[[1]])
441441
}
442442
}
443443

@@ -486,7 +486,8 @@ scrape_github_mastodon <- function(login){
486486
}, error = message)
487487
}
488488

489-
filter_topics <- function(x){
489+
normalize_tags <- function(x){
490+
x <- unique(tolower(x))
490491
setdiff(x, c("r", "rstats", "cran", "r-cran", "cran-r", "r-package", "r-packages", "rpackage", "package", "r-stats", "rstats-package"))
491492
}
492493

@@ -512,21 +513,21 @@ get_gitstats <- function(repo, pkgdir, url){
512513
tags = latest_tags(repo = repo)
513514
)
514515
pkgname <- read_description_field('Package', pkgdir)
515-
keywords <- filter_topics(get_schema_keywords(pkgdir))
516+
keywords <- normalize_tags(get_schema_keywords(pkgdir))
516517
biocinfo <- tryCatch(bioc_releases(pkgname), error = message)
517518
if(length(biocinfo)){
518519
out$bioc <- biocinfo
519520
}
520521
if(length(keywords)){
521-
out$topics <- unique(keywords)
522+
out$topics <- keywords
522523
}
523524
if(!length(url) || !grepl('^https?://github.com', url)){
524525
return(out)
525526
}
526527
repo <- sub("^https?://github.com/", "", url)
527528
repo <- sub("/$", "", repo)
528529
ghinfo <- gh::gh(sprintf('/repos/%s', repo))
529-
ghtopics <- filter_topics(unlist(ghinfo$topics))
530+
ghtopics <- normalize_tags(unlist(ghinfo$topics))
530531
if(length(ghtopics))
531532
out$topics <- unique(c(out$topics, ghtopics))
532533
if(tolower(ghinfo$owner$login) != tolower(dirname(repo))){

0 commit comments

Comments
 (0)