<commit_before><?php

namespace ObjectCalisthenics\Tests;

use PHP_CodeSniffer;

final class CodeSnifferRunner
{
    /**
     * @var PHP_CodeSniffer
     */
    private $codeSniffer;

    public function __construct()
    {
        $this->codeSniffer = new PHP_CodeSniffer();
    }

    /**
     * @param string $testedFile
     * @param string $sniffName
     *
     * @return int
     */
    public function detectErrorCountInFileForSniff($testedFile, $sniffName)
    {
        $this->codeSniffer->initStandard('../../../../../src/ObjectCalisthenics', [$sniffName]);
        $codeSnifferFile = $this->codeSniffer->processFile($testedFile);<commit_msg>tests: CodeSnifferRunner - use absolute path<commit_after><?php

namespace ObjectCalisthenics\Tests;

use PHP_CodeSniffer;

final class CodeSnifferRunner
{
    /**
     * @var PHP_CodeSniffer
     */
    private $codeSniffer;

    public function __construct()
    {
        $this->codeSniffer = new PHP_CodeSniffer();
    }

    /**
     * @param string $testedFile
     * @param string $sniffName
     *
     * @return int
     */
    public function detectErrorCountInFileForSniff($testedFile, $sniffName)
    {
        $this->codeSniffer->initStandard(__DIR__.'/../src/ObjectCalisthenics', [$sniffName]);
        $codeSnifferFile = $this->codeSniffer->processFile($testedFile);
{'fraction_non_alphanumeric': 0.12893553223388307, 'fraction_numerical': 0.0, 'mean_word_length': 2.9614243323442135, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2332871', 'n_tokens_mistral': 422, 'n_tokens_neox': 411, 'n_words': 71}