<commit_before>'use strict'

const Fetch = require('node-fetch')
const Qs = require('qs')
const _ = require('lodash')

const Logger = require('../util/logger')
const logger = Logger.global.chain('[jira]')

const queryFields = [
  'key',
  'issuetype',
  'summary',
  'project',
  'priority',
  'status',
  'labels',
  'issuelinks',
  'updated'
].join(',')

function convertIssue (rawIssue) {
  const issue = {
    key: rawIssue.key,
    summary: rawIssue.fields.summary,
    type: rawIssue.fields.issuetype.name,
    project: rawIssue.fields.project.name,
    projectKey: rawIssue.fields.project.key,
    priority: rawIssue.fields.priority.name,
    labels: rawIssue.fields.labels,
    status: rawIssue.fields.status.name,
    statusCategory: rawIssue.fields.status.statusCategory.name,
    updated: rawIssue.fields.updated
  }
  issue.links = []
  if (rawIssue.fields.issuelinks) {
    rawIssue.fields.issuelinks.forEach((rawLink) => {
      if (rawLink.inwardIssue) {
        issue.links.push({
          type: rawLink.type.name,
          direction: 'inward',
          srcKey: rawIssue.key,
          label: rawLink.type.inward,
          dstKey: rawLink.inwardIssue.key
        })
      }
      if (rawLink.outwardIssue) {
        issue.links.push({
          type: rawLink.type.name,
          direction: 'outward',
          srcKey: rawIssue.key,
          label: rawLink.type.outward,
          dstKey: rawLink.outwardIssue.key<commit_msg>capture status of link destination issue<commit_after>'use strict'

const Fetch = require('node-fetch')
const Qs = require('qs')
const _ = require('lodash')

const Logger = require('../util/logger')
const logger = Logger.global.chain('[jira]')

const queryFields = [
  'key',
  'issuetype',
  'summary',
  'project',
  'priority',
  'status',
  'labels',
  'issuelinks',
  'updated'
].join(',')

function convertIssue (rawIssue) {
  const issue = {
    key: rawIssue.key,
    summary: rawIssue.fields.summary,
    type: rawIssue.fields.issuetype.name,
    project: rawIssue.fields.project.name,
    projectKey: rawIssue.fields.project.key,
    priority: rawIssue.fields.priority.name,
    labels: rawIssue.fields.labels,
    status: rawIssue.fields.status.name,
    statusCategory: rawIssue.fields.status.statusCategory.name,
    updated: rawIssue.fields.updated
  }
  issue.links = []
  if (rawIssue.fields.issuelinks) {
    rawIssue.fields.issuelinks.forEach((rawLink) => {
      if (rawLink.inwardIssue) {
        issue.links.push({
          type: rawLink.type.name,
          direction: 'inward',
          srcKey: rawIssue.key,
          label: rawLink.type.inward,
          dstKey: rawLink.inwardIssue.key,
          dstStatus: rawLink.inwardIssue.fields.status.name,
          dstStatusCategory: rawLink.inwardIssue.fields.status.statusCategory.name
        })
      }
      if (rawLink.outwardIssue) {
        issue.links.push({
          type: rawLink.type.name,
          direction: 'outward',
          srcKey: rawIssue.key,
          label: rawLink.type.outward,
          dstKey: rawLink.outwardIssue.key,
          dstStatus: rawLink.outwardIssue.fields.status.name,
          dstStatusCategory: rawLink.outwardIssue.fields.status.statusCategory.name
{'fraction_non_alphanumeric': 0.1313414254590725, 'fraction_numerical': 0.0, 'mean_word_length': 2.872289156626506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6578653', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1025, 'n_words': 178}