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
Add automated @todo fixing. #125
Conversation
6a939d4
to
2d6d69d
Compare
2d6d69d
to
cf0e613
Compare
Awaiting the Travis checks, but unit tests and code style checks were passing locally. |
This looks good. Leaving the empty |
Tested locally and I confirm that the problem @klausi reported with the empty todo causing the next line to be appended up is fixed. However, when there is no text in the todo tag but the formatting of the todo can be fixed, eg @to-do or @todo:, etc then this is marked as fixable (which is partly true). Running the fixer correct them to be I tried to investigate this, but something unexpected is happening. Even when $fix is false the file is still being altered. Does the line |
Did some more investigation and I am even more at a loss as to what is happening. When running
Two problems: |
Just to clarify, the comment on #123 in regards to the incorrect fix and the request for the There is currently 1 PHPStan test result which should be fixed, the others will be fixed via #126. These tests can be validated locally by running
@jonathan1055 Your understanding of I'm unsure why these issues are happening in your environment. I'm currently getting the expected result while running |
Looking into this next. |
I didn't fully follow/understand all of the conversation above, but I added tests for this new scenario, and everything is passing. I also altered some unrelated files in my codebase and ran the fixer on them and got the following output for these problems: Code:
Output:
Result:
It wasn't happy that it found rows that I marked as fixable, but then it was only able to fix some of the problems and not all of them. I'm not sure this is a bug though, it seems like the desired result. I am not seeing the trailing space being added though. So I think all issues have been addressed unless I'm told otherwise. 🤞 |
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.
So I think all issues have been addressed unless I'm told otherwise
I made a couple of comments in the review below. I thought I had submitted these, but seems it was still pending. Just changes to test data rows order, and additional comments on the tests.
// This is not a todo tag. It is a general comment and we do not want | ||
// to do the standards checking here. | ||
|
||
// These are all incorrect. |
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.
I think it might be helpful if you change "These are all incorrect" to say "These are all incorrect but can be fixed automatically" and then move the bad un-fixable cases to a group at the end, with a comment "These are incorrect and not auto-fixable" or something like that.
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.
Also add cases // @to-do
and // @TODO
with no text, to demonstrate what happens to them. These were the ones I had difficulty with.
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.
Updated the test cases and comments per the requests above.
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.
Looks good now. Thanks
Drupal.org issue: https://www.drupal.org/project/coder/issues/3177471
This replaces: #123.
Results in the following
I fixed the new line creation and added a test for
@todo
statements by themselves. I added logic that marks them as unfixable since we can't know what the description should be.