Skip to content

Commit

Permalink
fix(ng-dev): add DEPRECATION to invalid commit message (#250)
Browse files Browse the repository at this point in the history
At the moment if `DEPRECATION :` is used to mark deprecations the commit validation will not fail. This PR addresses this.

PR Close #250
  • Loading branch information
alan-agius4 authored and josephperrott committed Oct 7, 2021
1 parent 792204a commit 87ee867
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ng-dev/commit-message/validate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,17 @@ describe('validate-commit-message.js', () => {
expectValidationResult(validateCommitMessage(incorrectKeyword3), INVALID, [
'The commit message body contains an invalid deprecation note.',
]);

const incorrectKeyword4 =
'feat(compiler): this is just a usual commit message title\n\n' +
'This is a normal commit message body which does not exceed the max length\n' +
'limit. For more details see the following super long URL:\n\n' +
'DEPRECATION:\n' +
' * A to be removed\n' +
' * B to be removed';
expectValidationResult(validateCommitMessage(incorrectKeyword4), INVALID, [
'The commit message body contains an invalid deprecation note.',
]);
});
});

Expand Down
3 changes: 2 additions & 1 deletion ng-dev/commit-message/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ const INCORRECT_BREAKING_CHANGE_BODY_RE =
*
* - `DEPRECATED <some-content>` | Here we assume the colon is missing by accident.
* - `DEPRECATIONS: <some-content>` | The wrong keyword is used here.
* - `DEPRECATION: <some-content>` | The wrong keyword is used here.
* - `DEPRECATE: <some-content>` | The wrong keyword is used here.
* - `DEPRECATES: <some-content>` | The wrong keyword is used here.
*/
const INCORRECT_DEPRECATION_BODY_RE = /^(DEPRECATED[^:]|DEPRECATIONS|DEPRECATE:|DEPRECATES)/m;
const INCORRECT_DEPRECATION_BODY_RE = /^(DEPRECATED[^:]|DEPRECATIONS?|DEPRECATE:|DEPRECATES)/m;

/** Validate a commit message against using the local repo's config. */
export function validateCommitMessage(
Expand Down

0 comments on commit 87ee867

Please sign in to comment.