Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ng-dev/commit-message/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface CommitMessageConfig {
minBodyLength: number;
minBodyLengthTypeExcludes?: string[];
scopes: string[];
disallowFixup?: boolean;
}

/** Assert the provided config contains a `CommitMessageConfig`. */
Expand Down
9 changes: 6 additions & 3 deletions ng-dev/commit-message/validate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,24 +269,27 @@ describe('validate-commit-message.js', () => {

describe('with `disallowFixup`', () => {
it('when true should fail', async () => {
setConfig({...config, commitMessage: {...config.commitMessage, disallowFixup: true}});

const msg = 'fixup! foo';

expectValidationResult(
await validateCommitMessage(msg, {
disallowFixup: true,
nonFixupCommitHeaders: ['foo', 'bar', 'baz'],
}),
INVALID,
['The commit must be manually fixed-up into the target commit as fixup commits are disallowed'],
[
'The commit must be manually fixed-up into the target commit as fixup commits are disallowed',
],
);
});

it('when false should pass', async () => {
setConfig({...config, commitMessage: {...config.commitMessage, disallowFixup: false}});
const msg = 'fixup! foo';

expectValidationResult(
await validateCommitMessage(msg, {
disallowFixup: false,
nonFixupCommitHeaders: ['foo', 'bar', 'baz'],
}),
VALID,
Expand Down
3 changes: 1 addition & 2 deletions ng-dev/commit-message/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {Commit, parseCommitMessage} from './parse.js';
/** Options for commit message validation. */
export interface ValidateCommitMessageOptions {
disallowSquash?: boolean;
disallowFixup?: boolean;
nonFixupCommitHeaders?: string[];
}

Expand Down Expand Up @@ -91,7 +90,7 @@ export async function validateCommitMessage(
// stripping the `fixup! ` prefix), otherwise we assume this verification will happen in another
// check.
if (commit.isFixup) {
if (options.disallowFixup) {
if (config.disallowFixup) {
errors.push(
'The commit must be manually fixed-up into the target commit as fixup commits are disallowed',
);
Expand Down
Loading