<commit_before><?php

namespace Akeneo\Inspector\Console\Command;

use Akeneo\Inspector\Coupling\Detector;
use Akeneo\Inspector\Coupling\UseViolationsFilter;
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;

/**
 * Detects the coupling issues in pim-community-dev
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/MIT MIT
 */
class PimCommunityCommand extends Command
{
    /**
     * {@inheritedDoc}
     */
    protected function configure()
    {
        $this
            ->setName('pim-community-dev')
            ->setDefinition(
                array(
                    new InputArgument('path', InputArgument::REQUIRED, 'The pim community dev src path', null),
                    new InputOption('strict', '', InputOption::VALUE_NONE, 'Apply strict rules without legacy exceptions'),
                )
            )
            ->setDescription('Detect coupling violations in pim-community-dev');
    }

    /**
     * {@inheritedDoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $path       = $input->getArgument('path');
        $strictMode = $input->getOption('strict');

        $namespaceToForbiddenUse = [
            'Akeneo/Component' => ['Pim', 'PimEnterprise', 'Bundle'],
            'Akeneo/Bundle'    => ['Pim', 'PimEnterprise'],
            'Pim/Component'    => ['PimEnterprise', 'Bundle'],
            'Pim/Bundle'       => ['PimEnterprise'],
        ];

        $legacyExclusions = [
            'Akeneo/Component' => [
                'Pim\Bundle\TranslationBundle\Entity\TranslatableInterface'
            ],
            'Akeneo/Bundle'    => [],<commit_msg>Remove path argument from pim community command<commit_after><?php

namespace Akeneo\Inspector\Console\Command;

use Akeneo\Inspector\Coupling\Detector;
use Akeneo\Inspector\Coupling\UseViolationsFilter;
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;

/**
 * Detects the coupling issues in pim-community-dev
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright 2015 Akeneo SAS (http://www.akeneo.com)
 * @license   http://opensource.org/licenses/MIT MIT
 */
class PimCommunityCommand extends Command
{
    /**
     * {@inheritedDoc}
     */
    protected function configure()
    {
        $this
            ->setName('pim-community-dev')
            ->setDefinition(
                array(
                    new InputOption('strict', '', InputOption::VALUE_NONE, 'Apply strict rules without legacy exceptions'),
                )
            )
            ->setDescription('Detect coupling violations in pim-community-dev');
    }

    /**
     * {@inheritedDoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        // check the project path
        $binPath = getcwd();
        $composerPath = $binPath.'/composer.json';
        $errorMessage = sprintf('You must launch the command from the pim-community-dev repository, not from "%s"', $binPath).PHP_EOL;
        if (!file_exists($composerPath)) {
            fwrite(STDERR, $errorMessage);
            exit(1);
        } else {
            $composerContent = file_get_contents($composerPath);
            if (false === strpos($composerContent, '"name": "akeneo/pim-community-dev"')) {
                fwrite(STDERR, $errorMessage);
                exit(1);
            }
        }
        $path = $binPath.'/src/';
        $strictMode = $input->getOption('strict');

        $namespaceToForbiddenUse = [
            'Akeneo/Component' => ['Pim', 'PimEnterprise', 'Bundle'],
            'Akeneo/Bundle'    => ['Pim', 'PimEnterprise'],
            'Pim/Component'    => ['PimEnterprise', 'Bundle'],
            'Pim/Bundle'       => ['PimEnterprise'],
        ];

        $legacyExclusions = [
            'Akeneo/Component' => [
                'Pim\Bundle\TranslationBundle\Entity\TranslatableInterface'
            ],
            'Akeneo/Bundle'    => [],
{'fraction_non_alphanumeric': 0.1334547938966067, 'fraction_numerical': 0.002277385561375541, 'mean_word_length': 2.4152410575427683, 'pattern_counts': {'":': 1, '<': 11, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '136097', 'n_tokens_mistral': 1290, 'n_tokens_neox': 1242, 'n_words': 230}