-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use brick's organization coding standards #62
base: master
Are you sure you want to change the base?
Conversation
0a4f18d
to
8246a26
Compare
8246a26
to
43629f4
Compare
@BenMorel FYI I'm waiting for this to be merged and make sure it works as expected before opening the related PR to other brick projects |
"symplify/easy-coding-standard": "^10.3", | ||
"slevomat/coding-standard": "^7.2", | ||
"squizlabs/php_codesniffer": "^3.7" | ||
"brick/coding-standards": "dev-main" |
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.
Should this still be in tools/ecs
? How will we handle this if we include Psalm in the coding-standards repo?
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.
Yes it should stay isolated because brick/coding-standards
is actually a composer package too that just wrap ECS and some additional packages for specific sniffers.
However you raise a good point about psalm. This meta package cannot group multiple tools into one package as it would fall into the dependency problem we tried to avoid in the first place.
The best option IMO would be to let each brick libraries require the tools independently and only use the coding-standards repo to share tools configuration files and github workflows.
This would bring some flexibility.
Downside is, every time there's a new tool version, each brick libraries have to be updated one by one. Could be automated at some point though.
AFAIU this what doctrine is doing.
jobs: | ||
coding-standards: | ||
name: Coding Standards | ||
uses: brick/coding-standards/.github/workflows/coding-standards.yml@main |
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.
Will this workflow run both ECS & Psalm from the coding standards repo, or do you want to separate them into different workflows? In the latter case, I'd prefer to keep the name coding-style
if we're going to run ECS only.
I basically consider the coding standards repo as containing:
coding-style
: ECSstatic-analysis
: Psalm
WDYT?
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.
Yeah agreed, let's add psalm workflow to this repository and properly split things like you mentioned.
@tigitz Thanks a lot! I now need to get a better picture of how things will fall into place when both Psalm & ECS will coexist in the coding-standards repo, and how this will translate into other repos such as |
@BenMorel digging a bit more about the inclusion of psalm as a shared tool for the org, I found that a Actually, doctrine doesn't share static analysis tools config nor versions https://github.com/doctrine/dbal/blob/3.3.x/composer.json#L45. Their coding standards repo is only meant for coding style tool. So if we want to do it for static analysis tools too, this would be the ideal setup IMO Splitting Another option I thought about was to have a single git repo From an usage POV, each brick library contributor would have to follow the same kind of instructions we have right now: # from project root
# coding style
composer install --working-dir=tools/coding-style
./tools/coding-style/vendor/bin/ecs check --config tools/coding-style/ecs.php
# static analysis
composer install --working-dir=tools/static-analysis
./tools/static-analysis/vendor/bin/psalm -c tools/static-analysis/psalm.xml If you're 👍 on the idea, could you please create the appropriate I'll start working on it right after. Thanks! |
@BenMorel friendly ping 😉 |
@tigitz Thank you for pursuing your work on this! I’m sorry I’m on vacation right now, and I’d like to think about this a bit more before multiplying dependencies; I’ll get back to you in ~1 week! Thanks for your patience! 👍 |
Hey @BenMorel, hope your vacations went well 🙂. If you can find some time to help moving this topic forward I'll be available. Thanks in advance. |
@BenMorel friendly ping :) |
This aim to use the organization's coding standards.
Needs brick/coding-standards#2 to be merged to see green CI results.
I've tested it under my own forks as you can see here: https://github.com/tigitz/date-time/actions/runs/2536125238
Library's specific handling of coding standard rules are kept in library's
ecs.php
file. It uses a$ecsConfig->import(__DIR__ . '/vendor/brick/coding-standards/ecs.php');
to import the shared rules.I've included a missing
DuplicateSpacesSniff
that I wasn't able to push before the merging of the previous PR.