<commit_before># -*- coding: utf-8 -*-

"""Test document formats for correctness
"""

import os
import pytest
import restructuredtext_lint as rstlint
from conftest import PROJ_DIR


def proj_rst_files():
    for f in os.listdir(PROJ_DIR):
        if f.endswith('.rst'):
            yield f


@pytest.mark.parametrize('filename', proj_rst_files())
def test_rst_syntax(filename):
    lint_result = rstlint.lint_file(filename)
    assert len(lint_result) == 0<commit_msg>better error reporting in docformat test<commit_after># -*- coding: utf-8 -*-

"""Test document formats for correctness
"""

import os
import pytest
import restructuredtext_lint as rstlint
from conftest import PROJ_DIR


def proj_rst_files():
    for f in os.listdir(PROJ_DIR):
        if f.endswith('.rst'):
            yield f


def _format_rst_lint_errors(errors):
    return ['{}: {}'.format(x.line,
                            x.full_message)
            for x in errors]


@pytest.mark.parametrize('filename', proj_rst_files())
def test_rst_syntax(filename):
    lint_result = rstlint.lint_file(filename)
    error_msg = '{}: {}'.format(
        filename,
        _format_rst_lint_errors(lint_result))
    assert len(lint_result) == 0, error_msg
{'fraction_non_alphanumeric': 0.1140278917145201, 'fraction_numerical': 0.003281378178835111, 'mean_word_length': 3.404332129963899, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4127546', 'n_tokens_mistral': 421, 'n_tokens_neox': 396, 'n_words': 96}