Skip to content

Commit

Permalink
feat: remove support for Waffle keywords parsing
Browse files Browse the repository at this point in the history
BREAKING CHANGE: remove support Waffle keywords as Waffle.io closed
  • Loading branch information
pvdlg committed Oct 8, 2019
1 parent 33460cd commit 0b3753d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 176 deletions.
29 changes: 1 addition & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# issue-parser

Parser for [Github](https://github.com), [GitLab](https://gitlab.com), [Bitbucket](https://bitbucket.org) and [Waffle](https://waffle.io) issues actions, references and mentions
Parser for [Github](https://github.com), [GitLab](https://gitlab.com) and [Bitbucket](https://bitbucket.org) issues actions, references and mentions

[![Travis](https://img.shields.io/travis/pvdlg/issue-parser.svg)](https://travis-ci.org/pvdlg/issue-parser)
[![Codecov](https://img.shields.io/codecov/c/github/pvdlg/issue-parser.svg)](https://codecov.io/gh/pvdlg/issue-parser)
Expand All @@ -10,7 +10,6 @@ The parser can identify:
- GitHub [closing keywords](https://help.github.com/articles/closing-issues-using-keywords), [duplicate keyword](https://help.github.com/articles/about-duplicate-issues-and-pull-requests), [issue references](https://guides.github.com/features/issues/#notifications) and [user mentions](https://guides.github.com/features/issues/#notifications)
- GitLab [closing keywords](https://docs.gitlab.com/ee/user/project/issues/automatic_issue_closing.html), [duplicate keyword](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12845), [issue references](https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected) and [user mentions](https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected)
- Bitbucket [closing keywords](https://confluence.atlassian.com/bitbucket/resolve-issues-automatically-when-users-push-code-221451126.html), [issue references](https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html) and [user mentions](https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html)
- Waffle.io [epics](https://help.waffle.io/epics/which-keywords-are-supported-with-epics) and [dependencies](https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies) keywords
- [Custom](#custom-format) or [additional](#extend-existing-format) keywords

## Install
Expand Down Expand Up @@ -80,28 +79,6 @@ parse('Issue description, ref user/package#1, fixing #2. /cc @user');
*/
```

### Waffle format

```js
const issueParser = require('issue-parser');
const parse = issueParser('waffle');

parse('Issue description, ref user/package#1, Fix #2, blocks user/package#3, Require #4, Parent of #5, Child of #6 /cc @user');
/*
{
refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],
actions: {
close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],
block: [{raw: 'blocks user/package#3', action: 'Blocks', slug: 'user/package', prefix: '#', issue: '3'}],
require: [{raw: 'Require #4', action: 'Require', prefix: '#', issue: '4'}],
parentOf: [{raw: 'Parent of #5', action: 'Parent of', prefix: '#', issue: '5'}],
childOf: [{raw: 'Child of #6', action: 'Child of', prefix: '#', issue: '6'}],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
*/
```

### Custom format

```js
Expand Down Expand Up @@ -341,10 +318,6 @@ Parser options. Can be `github`, `gitlab` or `bitbucket` for predefined options,
Type: `Object`<br>
Default:
`{close: ['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fixing', 'resolve', 'resolves', 'resolved', 'resolving', 'implement', 'implements', 'implemented', 'implementing'],
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'],
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'],
parentOf: ['parent of', 'parent to', 'parent'],
childOf: ['child of', 'child to', 'child'],
duplicate: ['Duplicate of', '/duplicate']}`

Object with type of action as key and array of keywords as value.
Expand Down
25 changes: 0 additions & 25 deletions lib/hosts-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,27 +84,6 @@ module.exports = {
hosts: ['https://gitlab.com'],
issueURLSegments: ['issues', 'merge_requests'],
},
waffle: {
actions: {
// https://help.waffle.io/dependencies/which-keywords-are-supported-with-dependencies
close: ['close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved'],
// https://help.github.com/articles/closing-issues-using-keywords
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'],
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'],
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics
parentOf: ['parent of', 'parent to', 'parent'],
// https://help.waffle.io/epics/which-keywords-are-supported-with-epics
childOf: ['child of', 'child to', 'child'],
// https://help.github.com/articles/about-duplicate-issues-and-pull-requests
duplicate: ['Duplicate of'],
},
delimiters: [':'],
// https://guides.github.com/features/issues/#notifications
mentionsPrefixes: ['@'],
issuePrefixes: ['#', 'gh-'],
hosts: ['https://github.com'],
issueURLSegments: ['issues', 'pull'],
},
default: {
actions: {
close: [
Expand All @@ -125,10 +104,6 @@ module.exports = {
'implemented',
'implementing',
],
block: ['blocks', 'block', 'required by', 'needed by', 'dependency of'],
require: ['blocked by', 'requires', 'require', 'need', 'needs', 'depends on'],
parentOf: ['parent of', 'parent to', 'parent'],
childOf: ['child of', 'child to', 'child'],
duplicate: ['Duplicate of', '/duplicate'],
},
delimiters: [':'],
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "issue-parser",
"description": "Parser for Github, GitLab, Bitbucket and Waffle issues actions, references and mentions",
"description": "Parser for Github, GitLab and Bitbucket issues actions, references and mentions",
"version": "0.0.0-development",
"author": "Pierre Vanduynslager (https://github.com/pvdlg)",
"bugs": {
Expand Down Expand Up @@ -41,8 +41,7 @@
"pr",
"pull-request",
"references",
"resolve",
"waffle"
"resolve"
],
"license": "MIT",
"main": "index.js",
Expand Down
123 changes: 3 additions & 120 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,47 +89,6 @@ test('Parse GitLab issue', t => {
);
});

test('Parse Waffle issue', t => {
t.deepEqual(
m('Waffle')(
'Fix #1 reSOLved gh-2 CLOSES Gh-3 fix o/r#4 #5 o/r#6 fix https://github.com/o/r/issues/7 https://github.com/o/r/issues/8 fix https://github.com/o/r/pull/9 https://github.com/o/r/pull/10 fixing #11 Duplicate OF #12 @user BloCks #13 Requires o/r#14 parent of https://github.com/o/r/issues/15 child to Gh-16'
),
{
actions: {
close: [
{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'},
{raw: 'reSOLved gh-2', action: 'Resolved', slug: undefined, prefix: 'gh-', issue: '2'},
{raw: 'CLOSES Gh-3', action: 'Closes', slug: undefined, prefix: 'Gh-', issue: '3'},
{raw: 'fix o/r#4', action: 'Fix', slug: 'o/r', prefix: '#', issue: '4'},
{raw: 'fix https://github.com/o/r/issues/7', action: 'Fix', slug: 'o/r', prefix: undefined, issue: '7'},
{raw: 'fix https://github.com/o/r/pull/9', action: 'Fix', slug: 'o/r', prefix: undefined, issue: '9'},
],
block: [{raw: 'BloCks #13', action: 'Blocks', slug: undefined, prefix: '#', issue: '13'}],
require: [{raw: 'Requires o/r#14', action: 'Requires', slug: 'o/r', prefix: '#', issue: '14'}],
parentOf: [
{
raw: 'parent of https://github.com/o/r/issues/15',
action: 'Parent of',
slug: 'o/r',
prefix: undefined,
issue: '15',
},
],
childOf: [{raw: 'child to Gh-16', action: 'Child to', slug: undefined, prefix: 'Gh-', issue: '16'}],
duplicate: [{raw: 'Duplicate OF #12', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '12'}],
},
refs: [
{raw: '#5', slug: undefined, prefix: '#', issue: '5'},
{raw: 'o/r#6', slug: 'o/r', prefix: '#', issue: '6'},
{raw: 'https://github.com/o/r/issues/8', slug: 'o/r', prefix: undefined, issue: '8'},
{raw: 'https://github.com/o/r/pull/10', slug: 'o/r', prefix: undefined, issue: '10'},
{raw: '#11', slug: undefined, prefix: '#', issue: '11'},
],
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
}
);
});

test('Parse with default options', t => {
t.deepEqual(
m()(
Expand All @@ -152,10 +111,6 @@ test('Parse with default options', t => {
},
{raw: 'Fix: #11', action: 'Fix', slug: undefined, prefix: '#', issue: '11'},
],
block: [],
require: [],
parentOf: [],
childOf: [],
duplicate: [{raw: 'Duplicate OF #10', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '10'}],
},
refs: [
Expand Down Expand Up @@ -188,10 +143,6 @@ test('Parse with custom options', t => {
{raw: 'Close* #12', action: 'Close', slug: undefined, prefix: '#', issue: '12'},
],
fix: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}],
block: [],
require: [],
parentOf: [],
childOf: [],
},
refs: [
{raw: 'o/r#4', slug: 'o/r', prefix: '#', issue: '4'},
Expand Down Expand Up @@ -221,10 +172,6 @@ test('Parse with options overrides', t => {
{
actions: {
close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}],
block: [],
require: [],
parentOf: [],
childOf: [],
},
refs: [
{raw: 'o/r#4', slug: 'o/r', prefix: '#', issue: '4'},
Expand Down Expand Up @@ -283,66 +230,6 @@ test('Parse actions.close', t => {
]);
});

test('Parse actions.block', t => {
t.deepEqual(m('waffle')('Blocks #1, Block #2').actions.block, [
{issue: '1', action: 'Blocks', slug: undefined, prefix: '#', raw: 'Blocks #1'},
{issue: '2', action: 'Block', slug: undefined, prefix: '#', raw: 'Block #2'},
]);
t.deepEqual(m('waffle')('Blocks #1,Block #2').actions.block, [
{issue: '1', action: 'Blocks', slug: undefined, prefix: '#', raw: 'Blocks #1'},
{issue: '2', action: 'Block', slug: undefined, prefix: '#', raw: 'Block #2'},
]);
t.deepEqual(m('waffle')('blocks #1, BLOCK #2').actions.block, [
{issue: '1', action: 'Blocks', slug: undefined, prefix: '#', raw: 'blocks #1'},
{issue: '2', action: 'Block', slug: undefined, prefix: '#', raw: 'BLOCK #2'},
]);
});

test('Parse actions.require', t => {
t.deepEqual(m('waffle')('Requires #1, Require #2').actions.require, [
{issue: '1', action: 'Requires', slug: undefined, prefix: '#', raw: 'Requires #1'},
{issue: '2', action: 'Require', slug: undefined, prefix: '#', raw: 'Require #2'},
]);
t.deepEqual(m('waffle')('Requires #1,Require #2').actions.require, [
{issue: '1', action: 'Requires', slug: undefined, prefix: '#', raw: 'Requires #1'},
{issue: '2', action: 'Require', slug: undefined, prefix: '#', raw: 'Require #2'},
]);
t.deepEqual(m('waffle')('requires #1, REQUIRE #2').actions.require, [
{issue: '1', action: 'Requires', slug: undefined, prefix: '#', raw: 'requires #1'},
{issue: '2', action: 'Require', slug: undefined, prefix: '#', raw: 'REQUIRE #2'},
]);
});

test('Parse actions.parentOf', t => {
t.deepEqual(m('waffle')('Parent of #1, Parent to #2').actions.parentOf, [
{issue: '1', action: 'Parent of', slug: undefined, prefix: '#', raw: 'Parent of #1'},
{issue: '2', action: 'Parent to', slug: undefined, prefix: '#', raw: 'Parent to #2'},
]);
t.deepEqual(m('waffle')('Parent of #1,Parent to #2').actions.parentOf, [
{issue: '1', action: 'Parent of', slug: undefined, prefix: '#', raw: 'Parent of #1'},
{issue: '2', action: 'Parent to', slug: undefined, prefix: '#', raw: 'Parent to #2'},
]);
t.deepEqual(m('waffle')('parent of #1, PARENT TO #2').actions.parentOf, [
{issue: '1', action: 'Parent of', slug: undefined, prefix: '#', raw: 'parent of #1'},
{issue: '2', action: 'Parent to', slug: undefined, prefix: '#', raw: 'PARENT TO #2'},
]);
});

test('Parse actions.childOf', t => {
t.deepEqual(m('waffle')('Child of #1, Child to #2').actions.childOf, [
{issue: '1', action: 'Child of', slug: undefined, prefix: '#', raw: 'Child of #1'},
{issue: '2', action: 'Child to', slug: undefined, prefix: '#', raw: 'Child to #2'},
]);
t.deepEqual(m('waffle')('Child of #1,Child to #2').actions.childOf, [
{issue: '1', action: 'Child of', slug: undefined, prefix: '#', raw: 'Child of #1'},
{issue: '2', action: 'Child to', slug: undefined, prefix: '#', raw: 'Child to #2'},
]);
t.deepEqual(m('waffle')('child of #1, CHILD TO #2').actions.childOf, [
{issue: '1', action: 'Child of', slug: undefined, prefix: '#', raw: 'child of #1'},
{issue: '2', action: 'Child to', slug: undefined, prefix: '#', raw: 'CHILD TO #2'},
]);
});

test('Parse actions.duplicate', t => {
t.deepEqual(m('github')('Duplicate of #1, DUPLICATE of #2').actions.duplicate, [
{issue: '1', action: 'Duplicate of', slug: undefined, prefix: '#', raw: 'Duplicate of #1'},
Expand Down Expand Up @@ -413,7 +300,7 @@ Fix #2

test('Empty options', t => {
t.deepEqual(m({actions: {close: []}, issuePrefixes: [], mentionsPrefixes: []})('Fix #1, @user'), {
actions: {block: [], require: [], parentOf: [], childOf: [], duplicate: []},
actions: {duplicate: []},
mentions: [],
refs: [],
});
Expand All @@ -423,10 +310,6 @@ test('Empty options', t => {
refs: [],
actions: {
close: [{issue: '1', action: 'Fix', slug: undefined, prefix: '#', raw: 'Fix #1'}],
block: [],
require: [],
parentOf: [],
childOf: [],
duplicate: [],
},
mentions: [{raw: '@user', prefix: '@', user: 'user'}],
Expand All @@ -436,7 +319,7 @@ test('Empty options', t => {

test('Empty String', t => {
const empty = {
actions: {close: [], block: [], require: [], parentOf: [], childOf: [], duplicate: []},
actions: {close: [], duplicate: []},
mentions: [],
refs: [],
};
Expand All @@ -448,7 +331,7 @@ test('Empty String', t => {
test('Throw TypeError for invalid options', t => {
t.throws(
() => m('missing-option'),
"The supported configuration are [github, bitbucket, gitlab, waffle, default], got 'missing-option'"
"The supported configuration are [github, bitbucket, gitlab, default], got 'missing-option'"
);
t.throws(() => m([]), 'The options argument must be a String or an Object');
t.throws(() => m(1), 'The options argument must be a String or an Object');
Expand Down

0 comments on commit 0b3753d

Please sign in to comment.