Skip to content

Empty strings are calculated as words, resulting in inaccurate scoring #16

@peterwoodworth

Description

@peterwoodworth

What is the problem?

The action will parse titles with the format (area) title into an array containing multiple empty strings.

Reproduction Steps

Submit an issue with the format (area) title, and the array of words which will be compared to keywords will be:

['', 'area', '', 'title']

Other Info

I'm not sure why the first empty string appears, but any other empty strings seem to appear when there are at least two characters adjacent to each other which used to split the string returned by the Github API.

This is set here:

if (title) {
excluded.forEach(ex => {
title.replace(ex, '');
});
this.titleIssueWords = title.split(/ |\(|\)|\./);
}
if (body) {
excluded.forEach(ex => {
body.replace(ex, '');
});
this.bodyIssueWords = body.split(/ |\(|\)|\./);
}


Additionally, the way punctuation is handled in this action isn't clear and should be more transparent.
It should also be more configurable by the user. Currently, nearly all punctuation is ignored when comparing strings to keywords:

str1 = str1.toLowerCase();
str2 = str2.toLowerCase();
// Regex for removing punctuation and replacing with empty string
str1 = str1.replace(/ |_|-|\(|\)|:|\`|\[|\]| |\./gi, '');
str2 = str2.replace(/ |_|-|\(|\)|:|\`|\[|\]| |\./gi, '');

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions