10000 [WIP] Refactor to become a PHP CS Fixer implementation by wouterj · Pull Request #14 · wouterj/docbot · GitHub
[go: up one dir, main page]

Skip to content

[WIP] Refactor to become a PHP CS Fixer implementation #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 23 commits into from

Conversation

wouterj
Copy link
Owner
@wouterj wouterj commented Nov 3, 2015

This has many benefits for the project, as we get a lot of things for free. The downside is that we need a rock solid parser/dumper for reStructured text. It still has edge cases which aren't properly supported.

@stof
Copy link
stof commented Nov 3, 2015

Why are you using the CS-Fixer project as base ? You only use the main Fixer entry point (in a way not needing most of its features) and the AbstractFixer (required because of the usage of Fixer, but not using any of its features actually).

Thus, it will be impossible to update your logic to use PHP-CS-Fixer 2.0 (and 1.x won't stay maintained long once 2.0 is ready), as the Fixer will operate on a Symfony\CS\Tokenizer\Tokens collection directly in 2.0.
IMO, you could inspire yourselves from PHP-CS-Fixer, but not reuse code. Btw, inspiring you from the 2.0 architecture might be better, as it would avoid parsing the rST multiple times during the process (once per fixer doing a change currently) and dumping it multiple times too (once per fixer)

Btw, your own Tokens implementation is flawed: caching does not work fine as you don't update the cache hash after updating the content in it. And you also have issues with caching (well, maybe not yet reachable because of the previous issue) as you don't ensure that all fixers are avoiding to corrupt the collection (i.e. the altered collection is equivalent to a collection generated for the resulting markup by the lexer).
Note that avoiding corrupted collection is even more important if you operate on the collection only

weaverryan added a commit to symfony/symfony-docs that referenced this pull request Nov 9, 2015
This PR was merged into the 2.3 branch.

Discussion
----------

Fixes done automatically by the docbot

Started working on the docbot again this week and these are the first results (to be honest: I did remove some invalid changes from this PR).

You can see the new docbot code (which is far from perfect) in wouterj/docbot#14

| Q | A
| --- | ---
| Doc fix? | yes
| New docs? | no
| Applies to | 2.3+
| Fixed tickets | -

Commits
-------

4dd3b8a Fixes done automatically by the docbot
@wouterj wouterj closed this Feb 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0