<commit_before>const axios = require('axios')

function detectIssueId (ref) {
    const reg = /^(feature|fix|hotfix|fixbug|bugfix|improve|solve|update)-(\d+)/i
    const matches = reg.exec(ref) || []
    return matches[2]
}

const USERMAP = {
    'ijse': '@清凌渡',
    'wang-jia': '@王佳',
    'gao-jx': '@jianxun gao',
    'JeannieMa': '@马柳菁',
    'liushumei': '@刘淑美'
}

module.exports = robot => {
    /*
    robot.on('pull_request.review_requested', async context => {
        const payload = context.payload
        const pr = payload.pull_request
        const reviewers = pr.requested_reviewers.map(r => r.login)
        const url = pr.html_url
        const reviewer = USERMAP[payload.requested_reviewer.login]
            || payload.requested_reviewer.login
        axios.post('http://bot.ijser.cn/api/ding', {
            to: 'fe',
            msg: `${USERMAP[pr.user.login]} 喊 ${reviewer} 来Review代码 ${url} !`
        })
    })
    */
    robot.on('pull_request.opened', async context => {
        const repo = context.repo()
        const pr = context.payload.pull_request
        const branchName = pr.head.ref

        pr.body = pr.body || ''
        console.log('check pr: ', pr.number)
        // link with issue
        const issueId = detectIssueId(branchName)<commit_msg>open reviewing function<commit_after>const axios = require('axios')

function detectIssueId (ref) {
    const reg = /^(feature|fix|hotfix|fixbug|bugfix|improve|solve|update)-(\d+)/i
    const matches = reg.exec(ref) || []
    return matches[2]
}

const USERMAP = {
    'ijse': '@清凌渡',
    'wang-jia': '@王佳',
    'gao-jx': '@jianxun gao',
    'JeannieMa': '@马柳菁',
    'liushumei': '@刘淑美'
}

module.exports = robot => {
    robot.on('pull_request.review_requested', async context => {
        const payload = context.payload
        const pr = payload.pull_request
        const reviewers = pr.requested_reviewers.map(r => r.login)
        const url = pr.html_url
        const reviewer = USERMAP[payload.requested_reviewer.login]
            || payload.requested_reviewer.login
        axios.post('http://bot.ijser.cn/api/ding', {
            to: 'fe',
            msg: `${USERMAP[pr.user.login]} 喊 ${reviewer} 来Review代码 ${url} !`
        })
    })
    robot.on('pull_request.opened', async context => {
        const repo = context.repo()
        const pr = context.payload.pull_request
        const branchName = pr.head.ref

        pr.body = pr.body || ''
        console.log('check pr: ', pr.number)
        // link with issue
        const issueId = detectIssueId(branchName)
{'fraction_non_alphanumeric': 0.15210608424336974, 'fraction_numerical': 0.00078003120124805, 'mean_word_length': 2.537931034482759, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '992605', 'n_tokens_mistral': 892, 'n_tokens_neox': 881, 'n_words': 163}