Skip to content

CS: apply phpdoc_annotation_without_dot reworked #20366

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

Closed

Conversation

keradus
Copy link
Member

@keradus keradus commented Oct 30, 2016

Q A
Branch? 2.7
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? n/a
Fixed tickets -
License MIT
Doc PR -

phpdoc_annotation_without_dot rule was requested by Symfony, most cases was adjusted in code, but the rule was a bit problematic to apply it everywhere.
This PR is based on extended implementation of that rule (see PHP-CS-Fixer/PHP-CS-Fixer#2247). I think it covers the problematic cases properly, but let us discuss.
Also, for that reason, I decided to put it in independent PR.

@wouterj
Copy link
Member

wouterj commented Oct 30, 2016

Is there a reason to capitialize some descriptions, but to lowercase others? It's seems quite inconsistent to me.

@keradus
Copy link
Member Author

keradus commented Oct 30, 2016

The intention for original rule was that the annotation description should not be a sentence, so we trim trailing dot. And if it's not a sentence, the leading char shouldn't be capitalized.
The fixer is not touching multi-sentence description, as it would break grammar.

@wouterj
Copy link
Member

wouterj commented Oct 30, 2016

Hmm, alright. Still it's weird that one-line descriptions like https://github.com/symfony/symfony/pull/20366/files#diff-70d56b3a86265721eccd933af82b7332R113 aren't fixed. Maybe the fixer only checks for final stops and not capitialized words?

@@ -108,15 +108,15 @@
*
* @param Definition|Reference $driver Driver DI definition or reference
* @param string[] $namespaces List of namespaces handled by $driver
* @param string[] $managerParameters List of container parameters that could
* hold the manager name.
* @param string[] $managerParameters list of container parameters that could
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with removing the dot, but changing the case here makes the docblocks very inconsistent as most places start with a capital letter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually it's the same comment like yours @wouterj .

Just to remind - idea behind fixer was that the description should not be a sentence, so it shouldn't have trailing full stop. In that case - it shouldn't start with capital letter as well.

From what I can remember it's the left-over from first implementation, where the dot was removed but capital letter was not modified.

Remembering the original goal - what about changing capital letter as well, even if trailing dot was already removed before ? If one would run only 2nd implementation of fixer (without 1st) - that would be the outcome.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fear that we will then have many changes that will cause lots of conflicts when merging branches.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we won't merge PRs that makes merging difficult.

@nicolas-grekas
Copy link
Member

👎 for me, unproven positive value, clear negative one (merge conflicts)

@keradus
Copy link
Member Author

keradus commented Nov 2, 2016

ref #19198

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Dec 6, 2016
@nicolas-grekas
Copy link
Member

Closing as won't fix: as commented, that'll creat merge conflicts - a final dot on comments doesn't deserve it (especially since we have so many PRs pending ;) )

@keradus
Copy link
Member Author

keradus commented Feb 14, 2017

@nicolas-grekas
thanks for update

Could you please specify is it a rule that would be nice to apply in new code, but not old (for the conflicts reason), or no willingness to follow it in new code as well ? Especially, as the rule was initially requested by Symfony.


btw, merging between own branches (like 2.x->2.y->3.z) could be make like:

  • make all branches synchronized
  • apply CS changes for lowest one
  • make to higher branch, discard all changes, apply CS fix by manually running a tool

(I know, it won't fix potential conflicts with branches on forks, where people work on PRs)

@nicolas-grekas
Copy link
Member

@keradus not sure I can tell you really... Right now, we have E_TOO_MANY_PR, so I've been a bit strict here, to help clean the backlog. The fix might happen later I guess (but would be great to have fabbot not patch the case of the first letter first :) )

@keradus
Copy link
Member Author

keradus commented Feb 14, 2017

So, some CS rules that Symfony wants, but not apply them, as of conflicts with merging. Cool to loosely follow it on new PR, but not in old, existing code.
Would be nice to extract that kind of rules to separated group somehow instead of dropping of forgot about them ;) If not, there is no much reasoning to prepare that kind of requested rules, if they would not be used after all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants