<commit_before>const _ = require('lodash');

const path = require('path');

const git = require('../../utils/git');
const emojis = require('../../utils/emojis');
const branches = require('../../utils/branches');
const execution = require('../../utils/execution');
const configuration = require('../../utils/configuration');
const { QUESTION_TYPES, ask } = require('../../utils/prompt');

const command = path.parse(__filename).name;
const aliases = [ command.charAt(0) ];
const describe = 'Commits the staged changes';

const CODE_REVIEW_MESSAGE = ':eyes: Code review';
const WIP_MESSAGE = ':construction: WIP';

const ARG_MESSAGE = {
  name: 'message',
  alias: 'm',
  describe: 'The message for the commit',
  type: 'array',
};

const ARG_CODE_REVIEW = {
  name: 'code-review',
  alias: 'c',
  describe: `Auto set the message to: ${CODE_REVIEW_MESSAGE.underline}`,
  type: 'boolean',
};

const ARG_WIP = {
  name: 'wip',
  alias: 'w',
  describe: `Auto set the message to: ${WIP_MESSAGE.underline}`,
  type: 'boolean',
};

const ARG_EMOJI = {
  name: 'emoji',
  alias: 'e',
  describe: 'Prefix the commit message with an emoji from https://github.com/quilicicf/Docs/blob/master/contribution/main.md',
  type: 'boolean',
};

const QUESTIONS = {
  CHOOSE_EMOJI: 'lib/git/execute:choose_emoji',
};

const QUESTION_EMOJI = {
  type: QUESTION_TYPES.AUTO_COMPLETE,
  id: QUESTIONS.CHOOSE_EMOJI,
  message: 'Choose your emoji: ',
  async source (answers, search = '') {
    return _.filter(
      emojis,
      emoji => emoji.value.toLocaleLowerCase().includes(search.toLocaleLowerCase()),
    );
  },
  pageSize: 10,
};

const getCommitMessage = (args) => {
  if (args[ ARG_CODE_REVIEW.name ]) {
    return CODE_REVIEW_MESSAGE;<commit_msg>:art: Put emoji on top of the list if code is equal to search in execute command<commit_after>const _ = require('lodash');

const path = require('path');

const git = require('../../utils/git');
const emojis = require('../../utils/emojis');
const branches = require('../../utils/branches');
const execution = require('../../utils/execution');
const configuration = require('../../utils/configuration');
const { QUESTION_TYPES, ask } = require('../../utils/prompt');

const command = path.parse(__filename).name;
const aliases = [ command.charAt(0) ];
const describe = 'Commits the staged changes';

const CODE_REVIEW_MESSAGE = ':eyes: Code review';
const WIP_MESSAGE = ':construction: WIP';

const ARG_MESSAGE = {
  name: 'message',
  alias: 'm',
  describe: 'The message for the commit',
  type: 'array',
};

const ARG_CODE_REVIEW = {
  name: 'code-review',
  alias: 'c',
  describe: `Auto set the message to: ${CODE_REVIEW_MESSAGE.underline}`,
  type: 'boolean',
};

const ARG_WIP = {
  name: 'wip',
  alias: 'w',
  describe: `Auto set the message to: ${WIP_MESSAGE.underline}`,
  type: 'boolean',
};

const ARG_EMOJI = {
  name: 'emoji',
  alias: 'e',
  describe: 'Prefix the commit message with an emoji from https://github.com/quilicicf/Docs/blob/master/contribution/main.md',
  type: 'boolean',
};

const QUESTIONS = {
  CHOOSE_EMOJI: 'lib/git/execute:choose_emoji',
};

const QUESTION_EMOJI = {
  type: QUESTION_TYPES.AUTO_COMPLETE,
  id: QUESTIONS.CHOOSE_EMOJI,
  message: 'Choose your emoji: ',
  async source (answers, search = '') {
    return _.reduce(
      emojis,
      (seed, emoji) => {
        const shouldAddEmoji = emoji.value.toLocaleLowerCase().includes(search.toLocaleLowerCase());

        if (!shouldAddEmoji) { return seed; }

        return emoji.value.toLocaleLowerCase() === `:${search.toLocaleLowerCase()}:`
          ? [ emoji, ...seed ]
          : [ ...seed, emoji ];
      },
      [],
    );
  },
  pageSize: 10,
};

const getCommitMessage = (args) => {
  if (args[ ARG_CODE_REVIEW.name ]) {
    return CODE_REVIEW_MESSAGE;
{'fraction_non_alphanumeric': 0.16873187450566834, 'fraction_numerical': 0.0015818613234906407, 'mean_word_length': 3.820838627700127, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2199484', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1316, 'n_words': 309}