- Issue created by @catch
- π¬π§United Kingdom catch
Moving this to gitlab templates in case it's possible via a phpcs configuration change in the default template rather than changing the actual sniff.
- πͺπΈSpain fjgarlin
The file to change would be: https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/scripts...
Core uses: https://git.drupalcode.org/project/drupal/-/blob/11.x/core/phpcs.xml.dis...
I donβt know how far we should get in tweaking the default file, but maybe we can take some of the rules from core.
I donβt know what drupalci did, but itβd be worth checking.
Having said all that, if a module has a phpcs file, it will be respected.
- π¬π§United Kingdom jonathan1055
I know that Drupal CI is about to be replaced by Gitlab-CI but the coding standards ruleset is a core file, so this should surely be a Core issue, in the Core queue? I think the linked scripts/phpcs.xml.dist is the file for this project to use on its own files? We should not be modifying it to make changes for other projects.
- πͺπΈSpain fjgarlin
The file is used as a fallback if a contrib module does not have one. See https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/include...
If drupalci uses for contrib the core file (doesnβt it contain core paths in it??) we could mirror the same here.
Itβs still unclear to me where this issue appeared. The fixes here would affect all contrib, but not core.
More details and CI runs links would help to narrow down the scope and the possible fix.
- π¬π§United Kingdom jonathan1055
Itβs still unclear to me where this issue appeared. The fixes here would affect all contrib, but not core.
Yes indeed. I don't think the issue should have been moved to this queue. It's about relaxing a coder sniff due to the receent Coding Standards change - heres the Change Record β (but oddly it is still in draft)
The sniff is Drupal.Commenting.FunctionComment.Missing and I have checked, there is no phpcs config option to ignore the sniff just for consturctor methods (I think that was wishfull thinking by @catch)
So this issue should go back to the Coder queue, to request a modification to the sniff.
- π¬π§United Kingdom catch
the coding standards ruleset is a core file, so this should surely be a Core issue, in the Core queue?
Core's file has this already:
<rule ref="Drupal.Commenting.ClassComment"> <exclude name="Drupal.Commenting.ClassComment.Missing"/> </rule>
The rule has never been enabled for core (like lots of rules), because it can take months to bring core up to a new coder sniff given the amount of 15 year old code in there. So from the point of view of core, this issue would only block enabling that rule. Contrib uses a different file as @fjgarlin points out.
- π¬π§United Kingdom jonathan1055
Yes that's right. I might have a quick look at the sniff to see what is involved. Is it just if the function name is then we can ignore the rule?
- π¬π§United Kingdom catch
Is it just if the function name is __construct then we can ignore the rule?
Yes exactly. In the original issue we discussed doing it for all magic methods, but it's fine to hardcode it to __construct().
- Assigned to jonathan1055
- π¬π§United Kingdom jonathan1055
What about ? Is that also covered by the relaxed rule, or is it just __construct ?
- π¬π§United Kingdom catch
No it's only constructors, the change record was wrong. Updated and published it..
- π¬π§United Kingdom jonathan1055
@klausi, sorry I created an issue fork here, forgetting that development and MRs should be against https://github.com/pfrenssen/coder
I can't delete the branch, see attached. Can you or someone else do it? - π¬π§United Kingdom jonathan1055
The PR is https://github.com/pfrenssen/coder/pull/215
First added test coverage to show that current sniff fails. - Issue was unassigned.
- Status changed to Needs review
about 1 year ago 5:13pm 10 November 2023 - π¬π§United Kingdom jonathan1055
https://github.com/pfrenssen/coder/pull/215/files is ready for review
-
jonathan1055 β
authored 0f95abc3 on 8.3.x
feat(FunctionComment): Docblock is not required for __constuct() methods...
-
jonathan1055 β
authored 0f95abc3 on 8.3.x
- Status changed to Fixed
11 months ago 5:30pm 27 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.