-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: StatementIndentationFixer - introduce stick_comment_to_next_continuous_control_statement config #7624
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
802f1d3
Partial Revert "feat: StatementIndentationFixer - support comment for…
keradus ce98947
feat: StatementIndentationFixer - introduce stick_comment_to_next_con…
keradus e1099ea
add example without config usage
keradus 86d1a12
reconfigure rulesets
keradus a1db1e6
regenerate docs
keradus bd28937
apply CS
keradus 9741cb0
CS
keradus a48a7c4
Merge branch 'master' into 7497
keradus 77c36a5
Update src/Fixer/Whitespace/StatementIndentationFixer.php
keradus File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this turned out to be too agressive - #7497 - and should therefore be not by default in any ruleset
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.
Why any ruleset? If Symfony's standard is like this, then it's OK to have it enabled. If you don't like this and you're using Symfony or PhpCsFixer standard as a base for your ruleset, then you need to re-configure this particular rule 🙂.
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.
No. The Symfony or PhpCsFixer standards are too aggresive in cases where comments are at the places mentioned in the issue, search https://github.com/roundcube/roundcubemail codebase for "7497", there are dozens places.
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 don't use these rulesets 🤷♂️? These are opinionated sets, you either accept how they work or prepare your own configuration. And just to remind, I don't like this behaviour at all because I believe it's impossible to determine the intent (where the comment belongs to) and from a logical point of view such comments should be intended just like everything inside the braces. But it was done on purpose to move it one step left, and now it can be configurable - leaving the same behaviour as default. It's the decision of rulesets' owners, not something you can argue 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.
The PHP CS Fixer is not reformatter, thus it should reformat to one, current?, indent, but allow the other valid/meaningful one too. I would say that would be better than hard/project wide configuration option.
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.
Reformatting is part of Fixer responsibility. Actually, quite a huge part of it - anything related to whitespaces or phpdocs can be understood as reformatting.
With previous complain that the change was too aggressive, we disable it by default for rule itself and allow everyone to opt-in, if they want to use it.
Same time, any community creating their standard has a freedom to decide where the comments should be placed. And it is that implemented rules are following existing standard, not that standard is adjusted to created rules. With that, if someone was already following Sf standards, they shall already have following each rules, even those without existing Fixer rules.
Any standard/rule can be called "too aggressive" by those who do not want to follow given rule. Happily, you can not only disable the rule now, but also configure it to your needs.