-
Notifications
You must be signed in to change notification settings - Fork 66
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
DOC Update coding conventions #397
DOC Update coding conventions #397
Conversation
dd0e3a0
to
fe5ef64
Compare
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
👍 Generally agree with all the proposed additions. It'd be great to have linter/phpcs/PhpStan rules for as many of these as possible. |
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.
There's some stuff here that seems like a duplication of the stuff below your additions - what's the intention there? Will you be removing all the old standards? Will you do a de-dupe separately? Or are the duplications not intended?
I'll hold off reviewing the existing standards until you've answered this.
I also assume that the other language coding standards have yet to be done.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
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.
Mostly feel strongly about trying to ratify member visibility, as some may remember from silverstripe/silverstripe-framework#8996.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
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.
There's a lot of good stuff in there!!!
I would make the following assumptions explicit once and avoid repeating them over and over:
- Best practices are approaches that will work well in most situations.
- It's OK to occasionally ignore them. (Maybe we want to have two classes ... the ones that are nice to have but not so important ... and the ones that should only be ignored as a last results)
- Best practices have not always been systematically applied, so you will encounter instances where they are not followed.
In term of language, I would be inclined to try to normalise it and avoid complicated dissertation. Maybe remove in-depth explanation of why we think something is a good.
I would focus on using the words "avoid" or "prefer" in most places. Maybe avoid using expression like "where possible" or "if practical".
Some extra questions we might want to address:
- Do we prefer Promises or Async/Await in JS?
- Prefer using the ORM instead of raw SQL.
- Prefer
DataObjectSchema::tableName()
to get the table name for DataObject rather then hardcode the value. - Prefer generic/standard SQL syntax that work across all DataBase.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
I'm against mentioning a preference here. They have different use-cases. Both are situational, and may even be used together, eg: const thing = await fetch('url').then(response => response.json());
This should be a rule (at least it was when I was last peer-reviewing 😅 ) |
205bb53
to
40b1e83
Compare
Have made recommended edits. Have also updated the content that was previously on the page and either made it much more concise or removed. Ready for review again |
40b1e83
to
33d0d14
Compare
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.
@maxime-rainville in #397 (review) you said
Maybe avoid using expression like "where possible" or "if practical".
There's still some of that in here so you may want to look and see if you're okay with the way that language has been used in the new revision.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
33d0d14
to
cb1c594
Compare
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.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
b7d6716
to
d5fb128
Compare
@maxime-rainville here are the specific things you need to double check: |
d5fb128
to
31a6d56
Compare
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.
Maybe avoid using expression like "where possible" or "if practical".
There's still some of that in here so you may want to look and see if you're okay with the way that language has been used in the new revision.
I had a glance and didn't see anything obviously standing out. By general point was that "where possible" or "if practical" is kind of implied when drafting best practices.
en/05_Contributing/05_Coding_Conventions/01_PHP_Coding_Conventions.md
Outdated
Show resolved
Hide resolved
31a6d56
to
2dcd339
Compare
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.
LGTM. No outstanding requested changes.
Issue #323
Right now it requires some discussion with @silverstripe/core-team to see everyone's happy with the conventions that I've added in< This has been doneThis PR will only focus on PHP. I've spun off a separate card for JS + SCSS