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
Use Rector to autofix code smell #4045
Conversation
A workflow should automatically suggest a new pull request with the changes. Initial fixes will not be applied from the auto generated PR but will be added as piece by piece commits with rule updates to this branch.
when using bootstrapping, these defines seem not to be auto detected anymore. We probably have to add a few more once we start running on plugins.
Seems rector was too aggressive here in removing a variable.
This broke tests. Ideally an Interface should be defined that both the real APICore and the TestPlugin implement.
prevent rector from rewriting this into an auto-assignment.
Good news: all the code sniffer rules are now applied as well. |
Please double check my usage of $auth instanceof AuthPlugin that I did not swap the logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next batch of reviews…
I'll do lib/ next.
I'm not 100% sure but revs might be strings sometimes, so better not chage current behavior
current revision is often passed as empty string
Okay, I think I'm through and addressed all comments. @Klap-in your auth instance changes look correct to me. Unless someone objects, I would merge this later today. We can (and should) always do small improvements later. |
This adds a configuration for rector and a new github workflow to automatically apply it when new code is pushed to master. The code is then also autofixed by php codesniffer. The result is auto submitted as pull request.
This PR also applies the changes suggested by rector in batches (see commits). I looked at all the changes made to ensure they seem valid, removed offending rules where it didn't and also manually reformatted some of the output. The latter is needed because rector isn't very good with white spaces and array formatting.
Ideally this is merged quickly to avoid merge conflicts but also to get the changed code into other people's hands to see if anything broke that was not found by tests.
The ultimate goal is to provide this mechanism to plugin authors to automatically update their plugins to new DokuWiki and PHP standards.
Post merge: