<commit_before><?php

namespace Bartlett\Reflect\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\TableHelper;

class AnalyserListCommand extends Command
{
    protected function configure()
    {
        $this
            ->setName('analyser:list')
            ->setDescription('List all analysers installed.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $var = $this->getApplication()->getJsonConfigFile();

        if (!is_array($var)) {
            throw new \Exception(
                'The json configuration file has an invalid format'
            );
        }

        if (!isset($var['analysers'])) {
            $fmt = $this->getApplication()->getHelperSet()->get('formatter');

            $output->writeln(
                $fmt->formatBlock(
                    array('[Json Configuration]', 'No analysers detected.'),
                    'error'
                )
            );
            return;
        }

        if (is_array($var['analysers'])) {
            $analysers = $var['analysers'];
        } else {
            $analysers = array($var['analysers']);
        }

        $headers = array('Analyser Name', 'Analyser Class');
        $rows = array();
        foreach ($analysers as $analyser) {
            $rows[] = array($analyser['name'], $analyser['class']);
        }
        sort($rows);

        $this->getApplication()
            ->getHelperSet()
            ->get('table')
            ->setLayout(TableHelper::LAYOUT_COMPACT)
            ->setHeaders($headers)
            ->setRows($rows)
            ->render($output)
        ;
    }
}
<commit_msg>enhance alert of empty analysers list<commit_after><?php

namespace Bartlett\Reflect\Command;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\TableHelper;

class AnalyserListCommand extends Command
{
    protected function configure()
    {
        $this
            ->setName('analyser:list')
            ->setDescription('List all analysers installed.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $var = $this->getApplication()->getJsonConfigFile();

        if (!is_array($var)) {
            throw new \Exception(
                'The json configuration file has an invalid format'
            );
        }

        if (!isset($var['analysers']) || empty($var['analysers'])) {
            $fmt = $this->getApplication()->getHelperSet()->get('formatter');

            $output->writeln(
                $fmt->formatBlock(
                    array('[Json Configuration]', 'No analysers detected.'),
                    'error'
                )
            );
            return;
        }

        if (is_array($var['analysers'])) {
            $analysers = $var['analysers'];
        } else {
            $analysers = array($var['analysers']);
        }

        $headers = array('Analyser Name', 'Analyser Class');
        $rows = array();
        foreach ($analysers as $analyser) {
            $rows[] = array($analyser['name'], $analyser['class']);
        }
        sort($rows);

        $this->getApplication()
            ->getHelperSet()
            ->get('table')
            ->setLayout(TableHelper::LAYOUT_COMPACT)
            ->setHeaders($headers)
            ->setRows($rows)
            ->render($output)
        ;
    }
}

{'fraction_non_alphanumeric': 0.13674104826154646, 'fraction_numerical': 0.0, 'mean_word_length': 2.0595238095238093, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 35, 'https://': 0, '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': '6434774', 'n_tokens_mistral': 1037, 'n_tokens_neox': 1026, 'n_words': 188}