func laptopToLive(c *cli.Context) { config, cnfErr := LoadConfig() if cnfErr != nil { println("Configuration Error:", cnfErr.Error()) return } dateRange := getDateFlag(c, "last 6 weeks") jiraClient := jira.Client{Config: config.Jira} api := jira.HttpApi{} var result jira.SearchResult err := jiraClient.QueryRecentlyDeployedIssues(api, dateRange, &result) changelogs, err := jiraClient.QueryChangelogsForResultSet(api, &result) average, max := jira.CalculateLaptopToLive(changelogs) if err != nil { return } println(fmt.Sprintf("Project: %s", config.Jira.Project)) println(fmt.Sprintf("Username: %s", config.Jira.Username)) println(fmt.Sprintf("%d total issues deployed", result.Total)) println(fmt.Sprintf("average laptop-to-live time: %f hours", average)) println(fmt.Sprintf("max laptop-to-live time: %f hours", max)) }
func bugRatio(c *cli.Context) { config, cnfErr := LoadConfig() if cnfErr != nil { println("Configuration Error:", cnfErr.Error()) return } dateRange := getDateFlag(c, "last 7 days") jiraClient := jira.Client{Config: config.Jira} api := jira.HttpApi{} var result jira.SearchResult err := jiraClient.QueryRecentlyCreatedIssues(api, dateRange, &result) if err != nil { return } bugsOverFeatures := jira.CalculateBugRatio(result) println(fmt.Sprintf("Project: %s", config.Jira.Project)) println(fmt.Sprintf("Username: %s", config.Jira.Username)) println(fmt.Sprintf("%d total issues created", result.Total)) println(fmt.Sprintf("bug ratio (bugs/features): %f", bugsOverFeatures)) }
func cycleTime(c *cli.Context) { config, cnfErr := LoadConfig() if cnfErr != nil { println("Configuration Error:", cnfErr.Error()) return } dateRange := getDateFlag(c, "last 7 days") jiraClient := jira.Client{Config: config.Jira} api := jira.HttpApi{} var result jira.SearchResult err := jiraClient.QueryRecentlyClosedIssues(api, dateRange, &result) if err != nil { return } average, max := jira.CalculateCycleTime(result) println(fmt.Sprintf("Project: %s", config.Jira.Project)) println(fmt.Sprintf("Username: %s", config.Jira.Username)) println(fmt.Sprintf("%d total issues resolved", result.Total)) println(fmt.Sprintf("average cycle time: %f hours", average)) println(fmt.Sprintf("max cycle time: %f hours", max)) }