Skip to content

Commit bdbb6f7

Browse files
authored
Release 1.0.3 (#14)
This commit marks the release of version 1.0.3.
1 parent e9a7c9a commit bdbb6f7

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

dist/index.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -567,16 +567,25 @@ function splitSubjectBody(message) {
567567
return result;
568568
}
569569
const capitalizedWordRe = new RegExp('^([A-Z][a-z]*)[^a-zA-Z]');
570+
const suffixHashCodeRe = new RegExp('\\s?\\(\\s*#[a-zA-Z_0-9]+\\s*\\)$');
570571
function checkSubject(subject) {
571572
const errors = [];
572-
if (subject.length > 50) {
573+
// Tolerate the hash code referring, e.g., to a pull request.
574+
// These hash codes are usually added automatically by Github and
575+
// similar services.
576+
const subjectWoCode = subject.replace(suffixHashCodeRe, '');
577+
if (subjectWoCode.length > 50) {
573578
errors.push(`The subject exceeds the limit of 50 characters, got: ${subject.length}`);
574579
}
575-
const match = capitalizedWordRe.exec(subject);
580+
const match = capitalizedWordRe.exec(subjectWoCode);
576581
if (!match) {
577582
errors.push('The subject must start with a capitalized verb (e.g., "Change").');
578583
}
579584
else {
585+
if (match.length < 2) {
586+
throw Error('Expected at least one group to match the first capitalized word, ' +
587+
'but got none.');
588+
}
580589
const word = match[1];
581590
if (!mostFrequentEnglishVerbs.SET.has(word.toLowerCase())) {
582591
errors.push('The subject must start in imperative mood with one of the ' +
@@ -586,7 +595,7 @@ function checkSubject(subject) {
586595
'for a complete list.');
587596
}
588597
}
589-
if (subject.endsWith('.')) {
598+
if (subjectWoCode.endsWith('.')) {
590599
errors.push("The subject must not end with a dot ('.').");
591600
}
592601
return errors;
@@ -8574,7 +8583,10 @@ exports.SET = new Set([
85748583
'refactor',
85758584
'reorganise',
85768585
'reorganize',
8577-
'restructure'
8586+
'restructure',
8587+
'unify',
8588+
'reword',
8589+
'rephrase'
85788590
]);
85798591

85808592

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mristin/opinionated-commit-message",
3-
"version": "1.0.2post2",
3+
"version": "1.0.3",
44
"description": "Github Action to check commit messages according to an opinionated style",
55
"keywords": [
66
"github",

0 commit comments

Comments
 (0)