Hello all, it’s time for the fortnightly coding standards meeting.
| quietone |
All the steps are shown as completed. |
| quietone |
So, this needs a review to make sure everything is done correctly. |
| quietone |
I see that Coder has a new release with a rule for this. We should have someone try that an then update or create new core issues. |
| Jonathan1055 |
The new coder rule does have full 'auto fixing' when you run phpcbf so for the contrib projects that will suddently be seeing new coding standards warnings, it is easy to solve. Is there a way that this can also be shared? |
| Björn Brala (bbrala) |
I'd say we should add 'finished' stuff to the posts we do also regarding final discussion if there are fixed issues. |
| Björn Brala (bbrala) |
nvm my suggestion. |
| Björn Brala (bbrala) |
im currently checking how core does with those new rules :x |
| Björn Brala (bbrala) |
but as its 'MAY' it shoudl technically be fine. |
| longwave |
fwiw we upgraded to the new Coder on a work project yesterday and phpcbf correctly fixed all of our badly formatted constructors (edited) |
| Björn Brala (bbrala) |
oh nice |
| Björn Brala (bbrala) |
Perhaps you could comment in the issue? |
| Björn Brala (bbrala) |
#3295249: Allow multi-line function declarations |
| longwave |
will do! |
| Björn Brala (bbrala) |
Then i'll close it up with some loving words heh |
| Björn Brala (bbrala) |
ah, i assumed core lol :stuck_out_tongue_winking_eye: sorry |
| longwave |
ah yeah not core :smile: |
| Björn Brala (bbrala) |
i'll check against core just to be sure if possible |
| Björn Brala (bbrala) |
Thanks though, real world validation is very helpful |
| longwave |
depending on where this is implemented in coder it might need adding to core's phpcs.xml.dist |
| Björn Brala (bbrala) |
yeah probably |
| Björn Brala (bbrala) |
i'll just do a quick rundown, see how it goes. |
| Björn Brala (bbrala) |
Yeah it seems we need a slight update to the phpcs.xml.dist |
| longwave |
if you open an issue in core queue i'm happy to help shepherd it along |
| Björn Brala (bbrala) |
thanks, will do |
| quietone |
We should also check if this effect any of the existing issues at #2571965: [meta] Fix PHP coding standards in core, stage 1 |
| quietone |
I don't think is does but best to be sure. |
| Björn Brala (bbrala) |
the new coder release you mean? (edited) |
| quietone |
I was referring to any change or new sniff specific for this issue. |
| Björn Brala (bbrala) |
kk, will do :slightly_smiling_face: |
| Björn Brala (bbrala) |
Well core doesnt comply with the standard it seems :stuck_out_tongue: |
| Björn Brala (bbrala) |
public static function cleanCssIdentifier($identifier, array $filter = [
' ' => '-',
'_' => '-',
'/' => '-',
'[' => '-',
']' => '',
]) {.
|
| Björn Brala (bbrala) |
and quite a few more |
| Björn Brala (bbrala) |
This is knida annoying...> phpcs --standard=core/phpcs.xml.dist --parallel="$( (nproc || sysctl -n hw.logicalcpu || echo 4) 2>/dev/null)" -- '--report-full' '--report-summary' '--report-\Micheh\PhpCodeSniffer\Report\Gitlab=phpcs-quality-report.json'
FILE: /builds/issue/drupal-3443117/core/lib/Drupal/Core/DrupalKernel.php
--------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
--------------------------------------------------------------------------------
556 | ERROR | Function return type is void, but function contains return
| | statement
--------------------------------------------------------------------------------
Time: 10.7 secs; Memory: 8MB
PHP CODE SNIFFER REPORT SUMMARY
--------------------------------------------------------------------------------
FILE ERRORS WARNINGS
--------------------------------------------------------------------------------
.../issue/drupal-3443117/core/lib/Drupal/Core/DrupalKernel.php 1 0
--------------------------------------------------------------------------------
A TOTAL OF 1 ERROR AND 0 WARNINGS WERE FOUND IN 1 FILE
--------------------------------------------------------------------------------
|
| Björn Brala (bbrala) |
but it does have:phpcs:ignore Drupal.Commenting.FunctionComment.VoidReturn |
| Björn Brala (bbrala) |
All the other fucntionas that had that added in commit a6c9dbbe28068daefb12bec06df45ab0f1850efe have no issue, only this one. |
| Björn Brala (bbrala) |
Drupal.Commenting.FunctionComment.VoidReturnversus Drupal.Commenting.FunctionComment.InvalidReturnVoid |
| Björn Brala (bbrala) |
mightve changes, ill look at that later, need to do some other stuff now. |
| Jonathan1055 |
Is that in the header? I think that phpcs:ignore is just for the next line of a file. For the rule to be ignored in the whole file, use phpcs:disable |
| Björn Brala (bbrala) |
It's in the docblock |
| Björn Brala (bbrala) |
But seems to target wrong sniff for some reason, or the sniff was renamed |
| Björn Brala (bbrala) |
Haven't investigated yet |
| Jonathan1055 |
If it is in the docblock then I think you need phpcs:disable not phpcs:ignore |
| longwave |
the first ignore worked, it's just that there are two rules to ignore now i think |
| longwave |
or we fix it so a void return function does not try to return anything :slightly_smiling_face: |
| longwave |
(this method is gone from Drupal 11 as it is unused) |
| Björn Brala (bbrala) |
perhaps the difference with the others is the fact other return void or empty return and this one scautlly returns something very diffrerent? |
| Björn Brala (bbrala) |
what would you prefer longwave? |
| Björn Brala (bbrala) |
fix ignore would be easiers probably (edited) |
| longwave |
yeah if we can just add a second ignore to the docblock and that solves it that seems easiest |
| Björn Brala (bbrala) |
will do |
| longwave |
the fix is also trivial but it's a bit scope-creep in a coder upgrade issue |
| Björn Brala (bbrala) |
yeah it is :stuck_out_tongue_winking_eye: |
| Björn Brala (bbrala) |
pushing |
| Björn Brala (bbrala) |
php cs is green, and did fail on a lot of trailing commas and such, so seems like core is happy :wink: https://git.drupalcode.org/issue/drupal-3443117/-/jobs/1415287 |
| Björn Brala (bbrala) |
This issue is ready for review.#3443117: Fix Drupal.Functions.MultiLineFunctionDeclaration coding standard |
| Björn Brala (bbrala) |
Think head is broken. gonna see what happens, im not the only one with that test failure.https://drupal.slack.com/archives/C1BMUQ9U6/p1713963828107659 |
Comments
Comment #2
quietone commentedAgree on form of UpperCamelCase and lowercamelcase and then update docs. From, https://www.drupal.org/project/coding_standards/issues/3339746#comment-1...
Comment #3
quietone commenteddiscuss #3098745: Should exit(); and die(); be called with or without parentheses?
Comment #8
quietone commentedComment #10
quietone commentedComment #11
quietone commentedComment #12
urvashi_vora commentedReviewed the conversation from slack. Looks good to me.
Comment #13
urvashi_vora commented