<commit_before><?php
namespace Mrimann\CoMo\Command;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "Mrimann.CoMo".          *
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;

/**
 * DataAggregatorCommand command controller for the Mrimann.CoMo package
 *
 * @Flow\Scope("singleton")
 */
class DataAggregatorCommandController extends \TYPO3\Flow\Cli\CommandController {

	/**
	 * @var \Mrimann\CoMo\Domain\Repository\CommitRepository
	 * @Flow\Inject
	 */
	var $commitRepository;

	/**
	 * @var \Mrimann\CoMo\Domain\Repository\AggregatedDataPerUserRepository
	 * @Flow\Inject
	 */
	var $aggregatedDataPerUserRepository;

	/**
	 * Processes the cached meta data and aggregates it to a usable format so they can be used easily
	 * for showing some results.
	 *
	 * @return void
	 */
	public function processCommitsCommand() {
		$unprocessedCommits = $this->commitRepository->findByIsAggregated(FALSE);

		if ($unprocessedCommits === NULL) {
			$this->outputLine('There are no commits to be processed.');
			return;
		}

		foreach ($unprocessedCommits as $commit) {
			$this->processSingleCommit($commit);
			$commit->setIsAggregated(TRUE);
			$this->commitRepository->update($commit);
		}

	}

	/**
	 * Processes a single commit and adds it (the numbers) to the aggregated data
	 *
	 * @param \Mrimann\CoMo\Domain\Model\Commit $commit
	 */
	protected function processSingleCommit(\Mrimann\CoMo\Domain\Model\Commit $commit) {
		$aggregatedDataBucket = $this->aggregatedDataPerUserRepository->findByCommitterAndMonth($commit);

		$aggregatedDataBucket->addCommit($commit);

		$this->aggregatedDataPerUserRepository->update($aggregatedDataBucket);
	}

}<commit_msg>[FEATURE] Silence the output of the data-aggregator<commit_after><?php
namespace Mrimann\CoMo\Command;

/*                                                                        *
 * This script belongs to the TYPO3 Flow package "Mrimann.CoMo".          *
 *                                                                        *
 *                                                                        */

use TYPO3\Flow\Annotations as Flow;

/**
 * DataAggregatorCommand command controller for the Mrimann.CoMo package
 *
 * @Flow\Scope("singleton")
 */
class DataAggregatorCommandController extends BaseCommandController {

	/**
	 * @var \Mrimann\CoMo\Domain\Repository\CommitRepository
	 * @Flow\Inject
	 */
	var $commitRepository;

	/**
	 * @var \Mrimann\CoMo\Domain\Repository\AggregatedDataPerUserRepository
	 * @Flow\Inject
	 */
	var $aggregatedDataPerUserRepository;

	/**
	 * Processes the cached meta data and aggregates it to a usable format so they can be used easily
	 * for showing some results.
	 *
	 * @param boolean whether the script should avoid any output
	 * @return void
	 */
	public function processCommitsCommand($quiet = FALSE) {
		$this->quiet = $quiet;

		$unprocessedCommits = $this->commitRepository->findByIsAggregated(FALSE);

		if ($unprocessedCommits->count() == 0) {
			$this->outputLine('There are no commits to be processed.');
			return;
		}

		foreach ($unprocessedCommits as $commit) {
			$this->processSingleCommit($commit);
			$commit->setIsAggregated(TRUE);
			$this->commitRepository->update($commit);
		}

		$this->outputLine('-> aggregated ' . count($unprocessedCommits) . ' commits.');

	}

	/**
	 * Processes a single commit and adds it (the numbers) to the aggregated data
	 *
	 * @param \Mrimann\CoMo\Domain\Model\Commit $commit
	 */
	protected function processSingleCommit(\Mrimann\CoMo\Domain\Model\Commit $commit) {
		$aggregatedDataBucket = $this->aggregatedDataPerUserRepository->findByCommitterAndMonth($commit);

		$aggregatedDataBucket->addCommit($commit);

		$this->aggregatedDataPerUserRepository->update($aggregatedDataBucket);
	}

}
{'fraction_non_alphanumeric': 0.11060834590246355, 'fraction_numerical': 0.0015082956259426848, 'mean_word_length': 2.637111517367459, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5216701', 'n_tokens_mistral': 1173, 'n_tokens_neox': 1078, 'n_words': 240}