<commit_before><?hh //strict

namespace typesafety;


final class TextReporter implements Listener
{

    public function onStop(Result $result) : void
    {
        $this->displayStatus($result);
        $this->displayErrors($result);
    }

    private function displayStatus(Result $result) : void
    {
        if ($result->isPassed()) {
            echo "Typing check passed", PHP_EOL;
        } else {
            echo "Typing check failed", PHP_EOL;
        }
    }

    private function displayErrors(Result $result) : void
    {
        $errors = $result->getErrors();

        foreach ($errors as $error) {
            $this->displayError($error);
        }
    }

    private function displayError(Error $error) : void
    {
        $messages = $error->getMessages();

        foreach ($messages as $message) {
            $this->displayMessage($message);
        }
    }

    private function displayMessage(Message $message) : void
    {
        echo $message->getPath(), PHP_EOL;
        echo $message->getDescription(), PHP_EOL;

        $lineNumber = $message->getLineNumber();
        $startAt = $message->getStartColumnNumber();
        $endAt = $message->getEndColumnNumber();

        $content = file_get_contents($message->getPath());
        $lines = explode("\n", $content);

        $record = $lines[$lineNumber - 1];

        $stringText = str_pad("^", $startAt, " ", STR_PAD_LEFT);
        $length = $startAt + ($endAt - $startAt);
        $stringText = str_pad($stringText, $length, "^");

        echo "  ", $record, PHP_EOL;
        echo "  ", $stringText, PHP_EOL;
    }

}
<commit_msg>fix report message<commit_after><?hh //strict

namespace typesafety;


final class TextReporter implements Listener
{

    public function onStop(Result $result) : void
    {
        $this->displayStatus($result);
        $this->displayErrors($result);
    }

    private function displayStatus(Result $result) : void
    {
        if ($result->isPassed()) {
            echo "Typing check passed", PHP_EOL;
        } else {
            echo "Typing check failed", PHP_EOL;
        }
        echo PHP_EOL;
    }

    private function displayErrors(Result $result) : void
    {
        $errors = $result->getErrors();

        foreach ($errors as $error) {
            $this->displayError($error);
        }
    }

    private function displayError(Error $error) : void
    {
        $messages = $error->getMessages();

        foreach ($messages as $message) {
            $this->displayMessage($message);
        }
    }

    private function displayMessage(Message $message) : void
    {
        echo $message->getPath(), PHP_EOL, PHP_EOL;

        $description = $message->getDescription();
        $texts = explode(PHP_EOL, $description);

        foreach ($texts as $text) {
            echo "  ", $text, PHP_EOL;
        }
        echo PHP_EOL;

        $lineNumber = $message->getLineNumber();
        $startAt = $message->getStartColumnNumber();
        $endAt = $message->getEndColumnNumber();

        $content = file_get_contents($message->getPath());
        $lines = explode(PHP_EOL, $content);

        $record = $lines[$lineNumber - 1];

        $stringText = str_pad("^", $startAt, " ", STR_PAD_LEFT);
        $length = $startAt + ($endAt - $startAt);
        $stringText = str_pad($stringText, $length, "^");

        echo "  ", $record, PHP_EOL;
        echo "  ", $stringText, PHP_EOL;
    }

}

{'fraction_non_alphanumeric': 0.13935860058309038, 'fraction_numerical': 0.0005830903790087463, 'mean_word_length': 2.2958693563880885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '5282945', 'n_tokens_mistral': 1026, 'n_tokens_neox': 991, 'n_words': 216}