Hello all, it’s time for the fortnightly coding standards meeting.
| quietone |
For this I think we still need to know what to do for core. There is the sniff Squiz.Functions.MultiLineFunctionDeclaration but many of it's sub components are disabled. |
| quietone |
Has anyone tested? |
| larowlan |
If we have something enforcing this, then we need to remove it. But because its 'allow' and not 'require' I don't think we'd be turning anything new on |
| quietone |
Ah, pedantic me should have realized that about 'allow' and 'require' |
| quietone |
I recall seeing multi-line function declaration in core. I just can't find an example |
| mstrelan |
\Drupal\Core\Extension\DatabaseDriver::__construct |
| quietone |
Thanks, I commented on the issue linking to that constructor |
| mstrelan |
No worries, there are quite a few more constructors like this too (edited) |
| dww |
Although \Drupal\Core\Extension\DatabaseDriver::__construct doesn't conform to what we're proposing the standard should be. So that (and others like it) would all need updating. |
| dww |
Don't we still want to enforce a standard on how they're formatted if they're used? Seems we still want a sniff, but it needs to be smart enough to ignore single-line functions. |
| dww |
#3295249: Allow multi-line function declarations#comment-15423374 |
| dww |
See https://drupal.slack.com/archives/C1BMUQ9U6/p1706612626929429 for recent example |
| dww |
In particular:#2323715: [policy, no patch] Determine format for commit credit for individuals/organizations/customers |
| larowlan |
There's already an established standard for this- conventional commits |
| dww |
Absolutely. |
| dww |
It's all spelled out in these issues. |
| larowlan |
I'm keen to explore using semantic-release for contrib |
| dww |
The problem is it keeps stalling out. |
| dww |
I want to drive it forward, and I'm wondering if this group can help. |
| dww |
The "by" line must go. We need short 1-liner summaries for each commit, just like our phpdoc comments. Everything else goes "below the fold". |
| larowlan |
https://www.conventionalcommits.org/en/v1.0.0/ |
| larowlan |
So much automation possible with ^ |
| larowlan |
All my npm packages I use github.com/semantic-release/semantic-release - you just commit with commit format per conventionalcommits and releases/changelogs/semver is all done for you |
| dww |
Do we consider the issue ID part of the "scope"? |
| larowlan |
even get nice comments on the PRs in each release |
| dww |
If there's no issue ID, hard -100 million to the proposal. |
| dww |
Oh, I see. Refs: #123 |
| dww |
Hrm, I love having those in the 1-line summaries. I'd hate to lose that by hiding such important info below the fold. |
| larowlan |
A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):
|
| larowlan |
so that sounds like we'd need our own version of that |
| larowlan |
https://git-scm.com/docs/git-interpret-trailers claims to be able to read the Refs: #1243 but I've never tested that |
| dww |
Hrm. Yeah, I hope we can keep the ref in the scope (or something), but that seems like a bit of a hack. |
| dww |
Or maybe we just have our own convention that the description always starts with #ID: ? (edited) |
| dww |
E.g.
fix(rest): #3402981: Filename property is not updated when a duplicate file is renamed In REST and JSON API file uploads
Authored-by: kim.pepper
Reviewed-by: quietone
Committed-by: larowlan(maybe we don't need the last since that's the author) (edited)
|
| dww |
(That's from the latest 11.x commit I see:)
commit 501e1ed2fb9eacb351d448f57fe33a5e3b8e200b
Author: Lee Rowlands <lee.rowlands@previousnext.com.au>
Date: Wed Jan 31 17:59:53 2024 +1000
Issue #3402981 by kim.pepper, larowlan, quietone: Filename property is not updated when a duplicate file is renamed In REST and JSON API file uploads
|
| larowlan |
yeah nothing in that standard prevents using #ID in description |
| dww |
That seems vastly cleaner than shoehorning into scope. |
| dww |
We can use 'scope' for component, more or less. |
| larowlan |
yes that's the intended use +1 |
| larowlan |
some tooling to help with conventional commits https://commitizen-tools.github.io/commitizen/ |
| dww |
Ideally, the issue / MR suggested commit message could format all this for us. |
| dww |
I guess all these will become gitlab labels, but whatever, we can still bolt some tooling (even if it's a browser extension or something :grimacing: ) that makes it easy to populate the merge commit message. |
| larowlan |
core committers have tooling for commit-checks etc, so could also be something cli worst case |
| dww |
I doubt anyone will write something to get d.o bespoke issue UI to give us these nice new messages automagically. |
| dww |
But a CI step to build a "commit artifact" for us is super clever. |
| dww |
Anyway, this has been a great discussion, but we're getting slightly off topic from my original intention, which was to get a sense from the rest of the committee / interested parties if this is a cause y'all are interested in collectively taking up under our own banner, or if I should bring this traffic elsewhere. :sweat_smile: |
| larowlan |
it does fall into a governance grey area, It feels like a TWG task but I think that's largely defunct |
| dww |
Personally, I consider the git history part of the "code" |
| dww |
And if our authority is to help craft / enforce standards to make for legible "code", that includes the commit messages. |
| dww |
But I'll totally grant this is subjective and a grey area. ;) |
| kimb0 |
We can specify multiple co-authors too:
Fixes: #[number redacted]
Co-Authored-By: Spam King <x@y.com>
Co-Authored-By: Monty Python <x@y.com>
|
| kimb0 |
instead of in the 1st line of the commit message |
| dww |
That's the primary change I'm advocating for. |
| dww |
From the other thread:
90% of the problem is putting all the “by” usernames between the issue ID and title. 8% are sloppy titles. 2% is wasting 5 bytes every commit with the word “Issue” that could instead tell you the category.
|
quietone, Jonathan1055, dww, larowlan, mstrelan, mherchel, catch, dww, larowlan, kim.pepper
Comments
Comment #2
quietone commentedAdding the current step for the current RTBC issues
Step 6/7
Step 8 - #3295249: Allow multi-line function declarations
Comment #3
quietone commentedAn older, stale, issue to bring to the meeting that is likely a won't fix. #1795750: Revise coding standards to use IETF RFC 2119 standards
Comment #11
quietone commentedComment #12
quietone commentedComment #13
quietone commentedComment #14
urvashi_vora commentedUpdated missing points in 6.1
Comment #15
urvashi_vora commentedAlso there is a point 8 opened on Feb 1st, are we including that in this?
Comment #16
bbralaThink inclusion is fine. Also seems to be complete.
Comment #17
larowlan