-
Notifications
You must be signed in to change notification settings - Fork 319
Fix 132 tags not found #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix 132 tags not found #136
Conversation
getLastTags should use pagination when the tag option were set to 2 tags and these tags weren not found yet
Codecov Report
@@ Coverage Diff @@
## master #136 +/- ##
===========================================
- Coverage 85.75% 38.69% -47.06%
===========================================
Files 7 7
Lines 316 323 +7
===========================================
- Hits 271 125 -146
- Misses 45 198 +153
Continue to review full report at Codecov.
|
@alexcanessa I don't understand why the codevcov tests are failing, do you have any clue? |
@wellDan28 I'm trying to understand. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wellDan28 don't worry for the codecov, it's going to automatically get fixed when master
runs.
lib/src/Gren.js
Outdated
_validateRequiredTagsExists(tags, requireTags) { | ||
if (requireTags.indexOf('all') >= 0 || !(requireTags instanceof Array)) return; | ||
|
||
const tagsNames = tags.map(x => x.tag.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use explicit parameters name (i.e. tagData
instead of x
)
lib/src/Gren.js
Outdated
if (missingTags.length > 0) { | ||
const notFoundMessage = (missingTags.length === 1) ? 'tag is' : 'tags are'; | ||
throw chalk.red(`\nThe following ${notFoundMessage} not found in the repository: ${missingTags}. ` + | ||
'please provider tags that are exists in the repository'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not everything in the template literal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry, I don't understand, could you please explain what you mean?
lib/src/Gren.js
Outdated
if (missingTags.length > 0) { | ||
const notFoundMessage = (missingTags.length === 1) ? 'tag is' : 'tags are'; | ||
throw chalk.red(`\nThe following ${notFoundMessage} not found in the repository: ${missingTags}. ` + | ||
'please provider tags that are exists in the repository'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change so that:
please provider tags that are exists in the repositoryplease provide existing tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wellDan28 last feedback, promise 👍
lib/src/Gren.js
Outdated
|
||
const missingTags = requireTags.filter(requireTag => tagsNames.indexOf(requireTag) < 0); | ||
if (missingTags.length > 0) { | ||
const notFoundMessage = (missingTags.length === 1) ? 'tag is' : 'tags are'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to notFoundMessage
inflection
as it makes more sense 👍
lib/src/Gren.js
Outdated
* Check that the require tags are exists in tags | ||
* | ||
* @param {Array} tags | ||
* @param {any} requireTags |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can expect requireTags
to be Array
because this.options.tags
it's always an Array
github-release-notes/lib/src/_utils.js
Lines 123 to 149 in 3e6b2e4
/** | |
* Converts an array like string to an actual Array, | |
* converting also underscores to spaces | |
* | |
* @since 0.6.0 | |
* @public | |
* | |
* @param {string} arrayLike The string of items | |
* e.g. | |
* "wont_fix, duplicate, bug" | |
* | |
* @return {Array} The items with spaces instead of underscores. | |
*/ | |
function convertStringToArray(arrayLike) { | |
if (!arrayLike) { | |
return []; | |
} | |
if (typeof arrayLike === 'object') { | |
return Object.keys(arrayLike).map((itemKey) => arrayLike[itemKey]); | |
} | |
return arrayLike | |
.replace(/\s/g, '') | |
.split(',') | |
.map((itemName) => itemName.replace(/_/g, ' ', itemName)); | |
} |
Also, replace the @return
with @throws
as the function is only returning undefined
lib/src/Gren.js
Outdated
if (missingTags.length > 0) { | ||
const notFoundMessage = (missingTags.length === 1) ? 'tag is' : 'tags are'; | ||
throw chalk.red(`\nThe following ${notFoundMessage} not found in the repository: ${missingTags}. ` + | ||
'please provide existing tags.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not one template literal?
@all-contributors please add @wellDan28 for bug |
I've put up a pull request to add @wellDan28! 🎉 |
@all-contributors please add @wellDan28 for code |
I've put up a pull request to add @wellDan28! 🎉 |
Close #132
The resolution contains two parts: