EndemolShineGroup/cz-jira-smart-commit

View on GitHub
src/lib/validation/validateIssues.ts

Summary

Maintainability
A
0 mins
Test Coverage
export default (input?: string) => {
  if (!input) {
    return 'Must specify issue IDs';
  }

  const lowerCasedInput = input.toLocaleLowerCase();
  if (lowerCasedInput === 'develop' || lowerCasedInput === 'master') {
    return [
      `You should not commit directly to the ${lowerCasedInput} branch.`,
      'Please create a feature branch first.',
    ].join(' ');
  }
  return /\w+-\d+/.test(input);
};