issue_check <- function(x) {
require(tidyverse)
require(purrr)
require(snakecase)
pens <- tibble(issue_nr = x$key,
is_pen_test = ifelse(any(x$fields$labels == 'PEN-Test')==TRUE,1,0),
is_pilot = ifelse(any(x$fields$labels == 'Pilot')==TRUE,1,0),
is_coba = ifelse(any(x$fields$labels == 'Pilot')==TRUE,1,0),
is_p = ifelse(any(x$fields$labels == 'P')==TRUE,1,0),
is_hotfix = ifelse(any(x$fields$labels == 'hotfix')==TRUE,1,0),
total = is_pen_test + is_pilot + is_coba + is_p + is_hotfix
)
return(pens)
}
other_test_issues <- function(project_url,project_id,username,password,max_results=NULL) {
require(httr)
require(jsonlite)
require(tidyverse)
start_point <- 0
tbl <- tibble()
repeat {
if(max_results > 50 || missing(max_results)) {
url <- paste(project_url,'/rest/api/2/search?jql=project=',project_id,'&startAt=',start_point,'&maxResults=',50,sep='')
} else {
url <- paste(project_url,'/rest/api/2/search?jql=project=',project_id,'&startAt=',start_point,'&maxResults=',max_results,sep='')
}
x <- GET(url,authenticate(username,password))
if (x$status_code == 401) {
print('Sorry, 401 Authentication failed')
return(tbl)
} else if (x$status_code == 403) {
print('Sorry, 403 error')
break
} else {
x <- content(x,'parsed')
z <- x$issues
if(length(z)<=1) {
print('We are finished')
break
}
y <- sapply(z,issue_check)
roll <- 1:length(z)
for (i in roll) {
ex <- as_tibble(y[,i])
tbl <- bind_rows(tbl,ex)
}
start_point <- start_point + length(z)
if(!missing(max_results)) {
max_results <- max_results - length(z)
if(max_results <= 0 || length(z) == 0) {
print('Yes, we are stopping')
break
}
}
}
}
tbl <- tbl %>%
filter(total > 0)
return(tbl)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.