<commit_before>import { GitCommit, GitCommitNote, GitCommitReference } from './../interfaces/git-commit.interface';

/**
 * Changelog transformer, primarily enhancing the commit content text
 */
export function changelogTransformer( repositoryUrl: string ) {

	return ( commit: GitCommit ) => {

		commit.notes.forEach( ( note: GitCommitNote ) => {
			note.title = 'BREAKING CHANGES';
		} );

		// Get full commit type from shorthand notation
		switch( commit.type ) {
			case 'feat':
				commit.type = 'Features';
				break;
			case 'fix':
				commit.type = 'Bug Fixes';
				break;
			case 'perf':
				commit.type = 'Performance Improvements';
				break;
			case 'style':
				commit.type = 'Styles';
				break;
			case 'docs':
				commit.type = 'Documentation';
				break;
			case 'refactor':
				commit.type = 'Refactoring';
				break;
			case 'test':
				commit.type = 'Tests'
				break;
			case 'chore':
				commit.type = 'Chores';
				break;
			case 'revert':
				commit.type = 'Reverts';
				break;
			default:
				return; // Skip commits without commit message convention (e.g. release commits)
		}

		// Ommit the scope if there is none defined
		if ( commit.scope === '*' ) {
			commit.scope = '';
		}

		// Get short hash value
		if ( typeof commit.hash === 'string' ) {
			commit.hash = commit.hash.substring( 0, 7 );
		}

		// Add hyperlinks
		const issues: Array<string> = [];
		if ( typeof commit.subject === 'string' ) {

			commit.subject = commit.subject

				// Link issues (including PRs)
				.replace( /#([0-9]+)/g, function( match: string, issue: string ) {
					issues.push( issue );
					return `[#${ issue }](${ repositoryUrl }/issues/${ issue })`;
				} )

				// Link users
				.replace( /@([a-zA-Z0-9_]+)/g, '[@$1](https://github.com/$1)' );

		}

		// Remove references that already appear in the subject
		commit.references = commit.references.filter( ( reference: GitCommitReference ) => {
			return issues.indexOf( reference.issue ) === -1;
		} );

		return commit;

	};

};<commit_msg>fix(changelog): Ignore chore & build & ci commits (#87)<commit_after>import { GitCommit, GitCommitNote, GitCommitReference } from './../interfaces/git-commit.interface';

/**
 * Commit types with title
 */
export const commitTypes: { [ type: string ]: string } = {
	feat: 'Features',
	fix: 'Bug Fixes',
	style: 'Styles',
	perf: 'Performance Improvements',
	docs: 'Documentation',
	refactor: 'Refactoring',
	test: 'Tests',
	// chore: 'Chores', // Ignored because internal
	// build: 'Buid System', // Ignored because internal
	// ci: 'Continuous Integration', // Ignored because internal
	revert: 'Reverts'
};

/**
 * Changelog transformer, primarily enhancing the commit content text
 */
export function changelogTransformer( repositoryUrl: string ) {

	return ( commit: GitCommit ) => {

		// Get full commit type from shorthand notation, skip if not defined (e.g. release commits)
		commit.type = commitTypes[ commit.type ];
		if ( !commit.type ) {
			return;
		}

		// Ommit the scope if there is none defined
		if ( commit.scope === '*' ) {
			commit.scope = '';
		}

		// Get short hash value
		if ( typeof commit.hash === 'string' ) {
			commit.hash = commit.hash.substring( 0, 7 );
		}

		// Add hyperlinks
		const issues: Array<string> = [];
		if ( typeof commit.subject === 'string' ) {

			commit.subject = commit.subject

				// Link issues (including PRs)
				.replace( /#([0-9]+)/g, function ( match: string, issue: string ) {
					issues.push( issue );
					return `[#${ issue }](${ repositoryUrl }/issues/${ issue })`;
				} )

				// Link users
				.replace( /@([a-zA-Z0-9_]+)/g, '[@$1](https://github.com/$1)' );

		}

		// Remove references that already appear in the subject
		commit.references = commit.references.filter( ( reference: GitCommitReference ) => {
			return issues.indexOf( reference.issue ) === -1;
		} );

		// Notes are always breaking changes
		commit.notes.forEach( ( note: GitCommitNote ) => {
			note.title = 'BREAKING CHANGES';
		} );

		return commit;

	};

};
{'fraction_non_alphanumeric': 0.15899477481960686, 'fraction_numerical': 0.004976362279173924, 'mean_word_length': 2.9920556107249254, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '957933', 'n_tokens_mistral': 1498, 'n_tokens_neox': 1270, 'n_words': 349}