-
Notifications
You must be signed in to change notification settings - Fork 16
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
Inserted boilerplate gets broken if there is a CRLF line break after the opening tag #176
Comments
I've made a PR for a fix that appears to stop this happening - #177 However, the CRLF still seems to be causing strange processing issues. Where it is an LF, the boilerplate comment sniff adds the boilerplate and the file is fixed in one pass. When the CRLF is there, there is a bunch of extra processing by various other sniffs and it takes five passes to come up with the final fixed file:
|
I'm a bit alarmed that Commenting.InlineComment is removing the blank lines from the boilerplate added by the fix here. I don't understand why this doesn't appear to happen when the file is just the opening PHP tag with an LF after it:
I also don't quite understand why this is not ending up in an infinite loop, where the blank lines are removed then fixed again etc. Is Commenting.InlineComment supposed to do this or could it be a bug? |
Fixes #176. Match blank boilerplate lines correctly.
I'm seeing an issue with the fix for the Files.BoilerplateComment sniff where there is a Windows line ending after the opening
<?php
tag.Running phpcbf with the moodle standard on this code:
<?php
gives this:
This doesn't happen if running the boilerplate sniff only (
vendor/bin/phpcbf --standard=moodle --sniffs=moodle.Files.BoilerplateComment
) and from looking at the processing output it looks as if it may be an interaction with moodle.Commenting.InlineComment which seems to remove the blank lines from the boilerplate, which BoilerplateComment then adds back in wrongly.I think there may be a couple of buggy things going on here so I'll try to work out in more detail what is happening.
The text was updated successfully, but these errors were encountered: