Skip all code blocks in the ensure_attribute_between_backticks_in_content rule - #2390
Skip all code blocks in the ensure_attribute_between_backticks_in_content rule#2390Amoifr wants to merge 1 commit into
Conversation
|
Not sure it's to error prone. Did you run it against all supported Symfony docs branches? |
|
Good call: about 17,000 fake attributes later, you were right to be suspicious 😄 With each branch's Since the docs are clean, that alone proves little, so I also injected a bare The fix is a 3 line change: lower the reference indentation when a non-directive line with less indentation is met. With it, every probe is reported, the symfony-docs output doesn't change on any branch (8 rules use Since it touches 8 rules, I'll open an issue and a dedicated PR for |
|
So let's close here? |
ca05974 to
4c8c718
Compare
|
Thanks for merging #2392! That one fixed With this PR on top, that line is gone and nothing else in the output moves: the three errors left on 8.2 are unrelated and were already there. So closing here would leave DOCtor-RST red on every symfony-docs 8.2 pull request, since the I just pushed it rebased on |
The rule only skipped
phpanddiffcode blocks, so an attribute inside any other code block was reported. symfony-docs hits it since symfony/symfony-docs#22926: thedebug:messengeroutput inmessenger.rstlistsApp\Message\DummyQuery (from #[AsMessage])inside a.. code-block:: terminal, and DOCtor-RST now fails on every8.2pull request.in()was called with[RstParser::CODE_BLOCK_DIFF], which restricts the match to diff blocks. Dropping the filter skips every code block, as #2170 did foruse_double_backticks_for_inline_literals.Tests
The existing diff case built its
RstSamplewithout a line number, so it checked line 0, the.. code-block::line itself, and passed whatever the rule did. The new cases point at the attribute line: diff, terminal, yaml, text and twig, plus thedebug:messengeroutput, and a guard showing that an attribute in the content right after a code block is still reported. Without the fix, the five non-diff cases fail. The PHP code block loop above has the same line 0 issue; I left it alone since fixing it means rewriting its samples, happy to do it here or separately.Verification
Running the patched rule over the symfony-docs
8.2branch,messenger.rstis no longer reported (the remaining Tui violations are fixed by symfony/symfony-docs#22983). The 2095 tests pass, PHPStan and PHP-CS-Fixer are clean, anddocs/rules.mdneeds no change.symfony-docs pins
oskarstark/doctor-rst:1.83.0, so it will need a bump once this is released.