Skip to content
This repository was archived by the owner on Apr 1, 2020. It is now read-only.

Commit de92316

Browse files
committed
refactor: clean up the code
1 parent aa698ef commit de92316

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

lib/lint.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,6 @@ const { lint, load } = require('@commitlint/core')
55
const config = require('./config')
66
const format = require('./format')
77

8-
// Globals
9-
const baseStatus = {
10-
context: 'commitlint-bot',
11-
// commitlint rules reference URL
12-
target_url: 'http://npm.im/@commitlint/config-angular#problems'
13-
}
14-
const pendingStatus = {
15-
...baseStatus,
16-
state: 'pending',
17-
description: 'Running commitlint for this PR'
18-
}
19-
208
/**
219
* Runs commitlint over all commits of the pull request and sets an appropriate
2210
* status check
@@ -29,11 +17,17 @@ const commitlint = async ({ github, payload }) => {
2917
const statusInfo = {
3018
sha: payload.pull_request.head.sha,
3119
repo: name,
32-
owner: owner.login
20+
owner: owner.login,
21+
context: 'commitlint-bot',
22+
target_url: 'http://npm.im/@commitlint/config-angular#problems'
3323
}
3424

3525
// Pending
36-
github.repos.createStatus({ ...statusInfo, ...pendingStatus })
26+
github.repos.createStatus({
27+
...statusInfo,
28+
state: 'pending',
29+
description: 'Waiting for the status to be reported'
30+
})
3731

3832
// Paginate all PR commits
3933
github.paginate(
@@ -56,7 +50,6 @@ const commitlint = async ({ github, payload }) => {
5650
// Final report
5751
github.repos.createStatus({
5852
...statusInfo,
59-
...baseStatus,
6053
state: report.valid ? 'success' : 'error',
6154
description: format(report)
6255
})

0 commit comments

Comments
 (0)