Skip to content

Malformed rules cause test suite to fail #181

@medubelko

Description

@medubelko

Situation

A regex error in one rule causes the entire test suite to collapse.

Example:

- (?<![\-\.\,:\/*-+#]|Day )0(?![\-\.\,:\/*-+]): zero
+ !(?<![\-\.\,:\/*-+#]|Day )0(?![\-\.\,:\/*-+]): zero

Gives:

test_config.py::test_colon_fence_arbitrary FAILED                                                                                    [  2%]
test_config.py::test_colon_fence_code FAILED                                                                                         [  4%]
test_config.py::test_colon_fence_code_block FAILED                                                                                   [  6%]
test_config.py::test_colon_fence_sourcecode FAILED                                                                                   [  8%]

...

FAILED test_rules.py::test_rule_cases[017b-Warn-code-over-35-lines::long-code-warning-rst-option] - RuntimeError: Vale invocation failed (rc=2).
STDERR:
{
  "Line": 12,
  "Path": "/dev/documentation-style-guide/styles/Canonical/013-Spell-out-numbers-below-10.yml",
  "Text": "did not find expected whitespace or line break",
  "Code": "E201",
  "Span": 1
}

When developing a rule, the huge error stack isn't completely clear that it's a validation problem. When all the rules fail in sequence, it looks like something in the tests is broken, not the rules.

Request

Vale is failing on every call, so I think the solution is to add a first test that ensures Vale can read the rules.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions