jiraxml

package module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 8 Imported by: 0

README

JiraXML

Build Status Go Report Card Docs License

JiraXML currently parses a Jira XML file consisting of multiple issues.

In addition to parsing the Jira XML into a Go struct, various aggregate staticstics are calculated.

The ability to generate a jiraxml.Issue struct from a JSON API struct defined by github.com/andygrunwald/go-jira is also under development.

URL Formats

Accessing a list of issues by JQL is avialable via the UI and API:

  • UI: https://{jira_host}/issues/?jql=
  • API: https://{jira_host}/rest/api/2/search?jql=

Note on Hours Per Day and Days Per Week

This module supports custom hoursPerDay and daysPerWeek settings per Jira.

This is described here and set in the UI via the screenshot below,

Ref: https://community.atlassian.com/t5/Jira-Software-questions/What-it-JIRA-counting-as-a-quot-day-quot-in-Time-Tracking/qaq-p/1703409

Also of note is that the hours per day can be set to a decimal value, such as 8.5, but the UI may not show it:

Ref: https://community.atlassian.com/t5/Jira-questions/change-quot-Working-hours-per-day-quot-by-a-decimal-value/qaq-p/583095

Additional Discussion on Jira XML

General Discussion

General discussion including using Jira XML to:

  1. export comments and issue link types
  2. create CSV for flexible reporting and import

Ref: https://community.atlassian.com/t5/Jira-questions/JIRA-Issue-XML-Export-What-is-it-good-for/qaq-p/603308

Global Config

Working Hours Per Day and Working Days Per Week are global values and cannot be set on a per-project basis.

Ref: https://community.atlassian.com/t5/Jira-Software-questions/Time-Tracking-Hours-Is-it-still-a-global-change/qaq-p/1337399

Documentation

Index

Constants

View Source
const (
	StatusClosed            = "Closed"
	StatusInProgress        = "In Progress"
	StatusPOReview          = "PO Review"
	StatusPendingValidation = "Pending Validation"
	StatusReady             = "Ready"

	TypeBug   = "Bug"
	TypeSpike = "Spike"
	TypeStory = "Story"

	WorkingHoursPerDayDefault float32 = 8.0
	WorkingDaysPerWeekDefault float32 = 5.0
)
View Source
const DMYDateFormat = "_2-01-2006"

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildInfo added in v0.2.0

type BuildInfo struct {
	Version     string        `xml:"version"`
	BuildNumber int64         `xml:"build-number"`
	BuildDate   DMYDateString `xml:"build-date"`
}

type Channel

type Channel struct {
	Title       string    `xml:"title"`
	Link        string    `xml:"link"`
	Description string    `xml:"description"`
	Language    string    `xml:"language"`
	BuildInfo   BuildInfo `xml:"build-info"`
	Issues      Issues    `xml:"item"`
}

type DMYDateString added in v0.2.0

type DMYDateString string

func (DMYDateString) Time added in v0.2.0

func (s DMYDateString) Time() (time.Time, error)

type Duration added in v0.2.0

type Duration struct {
	Display string `xml:",chardata"`
	Seconds int64  `xml:"seconds,attr"`
}

func (*Duration) Duration added in v0.2.0

func (d *Duration) Duration() time.Duration

func (*Duration) TrimSpace added in v0.3.0

func (d *Duration) TrimSpace()

type EstimateStats

type EstimateStats struct {
	WithEstimate    int
	WithoutEstimate int
}

type EstimateVsActual

type EstimateVsActual struct {
	ClosedCount             int
	ClosedCountWithEstimate int
	EstimateDays            float64
	ActualDays              float64
	EstimateRatio           float64
}

func (*EstimateVsActual) Inflate

func (eva *EstimateVsActual) Inflate()

type Issue added in v0.3.0

type Issue struct {
	Type                           Simple         `xml:"type"`
	Title                          string         `xml:"title"`
	Description                    string         `xml:"description"`
	Link                           string         `xml:"link"`
	Key                            Simple         `xml:"key"`
	Project                        Project        `xml:"project"`
	Resolution                     Simple         `xml:"resolution"`
	Summary                        string         `xml:"summary"`
	Status                         Status         `xml:"status"`
	Assignee                       User           `xml:"assignee"`
	Reporter                       User           `xml:"reporter"`
	FixVersion                     string         `xml:"fixVersion"`
	TimeEstimate                   Duration       `xml:"timeestimate"`
	TimeOriginalEstimate           Duration       `xml:"timeoriginalestimate"`
	TimeSpent                      Duration       `xml:"timespent"`
	AggregateTimeEstimate          Duration       `xml:"aggregatetimeestimate"`
	AggregateTimeOriginalEstimate  Duration       `xml:"aggregatetimeoriginalestimate"`
	AggregateTimeRemainingEstimate Duration       `xml:"aggregatetimeremainingestimate"`
	AggregateTimeSpent             Duration       `xml:"aggregatetimespent"`
	Labels                         []Label        `xml:"labels"`
	Created                        RFC1123ZString `xml:"created"`  // RFC1123Z
	Updated                        RFC1123ZString `xml:"updated"`  // RFC1123Z
	Resolved                       RFC1123ZString `xml:"resolved"` // RFC1123Z
	Votes                          int            `json:"votes"`
	Watches                        int            `json:"watches"`
}

func IssueFromAPI added in v0.4.0

func IssueFromAPI(iss jira.Issue) Issue

func (*Issue) TrimSpace added in v0.3.0

func (i *Issue) TrimSpace()

TrimSpace removes leading and trailing space. It is useful when parsing XML that has been modified, such as by VS Code extensions.

type Issues added in v0.3.0

type Issues []Issue

func (Issues) FilterByStatus added in v0.3.0

func (ii Issues) FilterByStatus(statuses ...string) Issues

func (Issues) Keys added in v0.3.0

func (ii Issues) Keys() []string

func (Issues) Stats added in v0.3.0

func (ii Issues) Stats(workingHoursPerDay, workingDaysPerWeek float32) IssuesStats

func (Issues) TSRHistogramSets added in v0.4.0

func (ii Issues) TSRHistogramSets(name string) *histogram.HistogramSets

TSRHistogramSets returns a `*histogram.HistogramSets` for Type, Status and Resolution.

func (Issues) TSRTable added in v0.4.0

func (ii Issues) TSRTable(name string) table.Table

TSRTable returns a `table.Table` for Type, Status and Resolution.

func (Issues) TSRWriteCSV added in v0.4.0

func (ii Issues) TSRWriteCSV(filename string) error

TSRWriteCSV writes a CSV file for Type, Status and Resolution.

type IssuesStats added in v0.3.0

type IssuesStats struct {
	WorkingHoursPerDay       float32
	WorkingDaysPerWeek       float32
	ItemCount                int
	ItemCountByStatus        map[string]int
	ItemCountByType          map[string]int
	EstimateStatsByType      map[string]EstimateStats
	TimeOriginalEstimate     time.Duration
	TimeOriginalEstimateDays float64
	AggregateTimeSpent       time.Duration
	AggregateTimeSpentDays   float64
	ClosedEstimateVsActual   EstimateVsActual
}

type Label

type Label struct {
	Label string `xml:"label"`
}

type Project

type Project struct {
	DisplayName string `xml:",chardata"`
	ID          int    `xml:"id,attr"`
	Key         string `xml:"key,attr"`
}

func (*Project) TrimSpace added in v0.3.0

func (p *Project) TrimSpace()

type RFC1123ZString

type RFC1123ZString string

func RFC1123ZStringJiraTime added in v0.4.0

func RFC1123ZStringJiraTime(t jira.Time) RFC1123ZString

func (RFC1123ZString) Time

func (s RFC1123ZString) Time() (time.Time, error)

type Simple added in v0.3.0

type Simple struct {
	ID          int    `xml:"id,attr"`
	DisplayName string `xml:",chardata"`
}

func (*Simple) TrimSpace added in v0.3.0

func (s *Simple) TrimSpace()

type Status

type Status struct {
	ID          int    `xml:"id,attr"`
	DisplayName string `xml:",chardata"`
	Description string `xml:"description,attr"`
	IconURL     string `xml:"iconUrl"`
}

type StatusCategory added in v0.3.0

type StatusCategory struct {
	ID          int    `xml:"id,attr"`
	DisplayName string `xml:",chardata"`
	Key         string `xml:"key,attr"`
	ColorName   string `xml:"colorName,attr"`
}

type User added in v0.3.0

type User struct {
	Display  string `xml:",chardata"`
	Username string `xml:"username,attr"`
}

func (*User) TrimSpace added in v0.3.0

func (u *User) TrimSpace()

type XML added in v0.2.0

type XML struct {
	Channel Channel `xml:"channel"`
}

func ReadFile

func ReadFile(name string) (XML, error)

func (*XML) TrimSpace added in v0.2.0

func (x *XML) TrimSpace()

TrimSpace removes leading and trailing space. It is useful when parsing XML that has been modified, such as by VS Code extensions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL