-
Notifications
You must be signed in to change notification settings - Fork 53
Create @todo format sniff. #118
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
Create @todo format sniff. #118
Conversation
Nice work. Will review shortly. I know that Klausi will want test coverage for this too. |
Did you actually run your latest changes? I get nothing reported at all, for both types of bad format. I use
|
Yes
I'd say yes, and you also enforced one space. These are all good, but I don't know if they are actually written in the standard? |
$comment = $tokens[$stackPtr]['content']; | ||
// Use the next line for multi-line comments. | ||
if ($tokens[$stackPtr]['code'] === T_DOC_COMMENT_TAG) { | ||
$comment = $phpcsFile->findNext(T_DOC_COMMENT_STRING, ($stackPtr + 1)); |
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.
The above will give the pointer not the comment text. You need something like
$pointer = $phpcsFile->findNext(T_DOC_COMMENT_STRING, ($stackPtr + 1));
$comment = $tokens[$pointer]['content'];
@jonathan1055 thanks for all of the great feedback. 🙏
I ran them a few regex iterations ago. I wanted to get a review on the high level approach first. Clearly I need to do some actual testing again though. I'll work on some fixes in the next couple days and report back. |
Nice work. I started looking at your changes, but now there are lots, I think I will wait until you say you are ready for review. Let me know. |
I was hoping this last commit would fix all of the remaining Travis issue, but it failed to build. I don't see a re-run tests option. So I might need some assistance here. Either way, I believe this is ready for review. The only other thing I can think to add is the ability to fix the issue automatically, but that might be a follow up PR. |
I created a local branch with all your changes and tried So I looked at the test file, and noticed in TodoCommentUnitTest.php Your recent change to split all the incorrect docbock @todo into a separate comment block (not sure why you did that) but anyway, these are not being found as valid docblocks because they only have
Definitely leave that until the main work is done. |
That's not what I wanted haha. I was running the sniffs locally, but wasn't running the tests locally and it shows haha. I'll get the tests running locally too as your next comment indicates there are still issues beyond the big one.
🤦 That would do it.
I had to do that to make the code alignment sniff happy. Some of the malformed statements were causing it to bark about how other things were indented, so I separated them. I was struggling with the formatting as the standards enforced in this repo are very different from the code style I'm used to working with. I'll try making the comments use I was seeing
👍 I'll get some updates pushed in the next couple days (maybe later today 🤞). |
Everything seems to be passing. ✅ |
Yes I saw in your commits you were having to work at it. However, the test files are not actually part of the standard phpcs scan so they are not subject to this checking. But unfortunately you had named yours
So, you can return to a simple test files, and I've done this in my copy of your branch, to save you the trouble - see I have a couple more questions but lets get the simple test file merged into your branch first. |
I have made a few more suggestions and pushed them to my branch.
I have made this change in the regex, and included test coverage. Overall excelent work, this will be a good addition. I hope you can easily compare my branch to yours and get the changes? If you want patches let me know. |
Hoping to find time to get back to this today. Thanks for the contributions! |
OK. If you want to discuss anything, I have just started using Slack. The coder channel is https://app.slack.com/client/T06GX3JTS/CJ19MV96J |
drupal.slack.com |
Closing in favor of #120. |
You made the comment: I forgot to say at the time that, yes, this standard is not what I'm used to. However, running |
Adds @todo format sniff.
Drupal.org issue:
Testing/Examples:
Questions:
//
be in the string that is sent to the sniff? If so, I need to adjust it.@todo
? (I went ahead and did this.)