Skip to content
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

238 phpcs scaffold #562

Merged
merged 6 commits into from
May 22, 2024
Merged

238 phpcs scaffold #562

merged 6 commits into from
May 22, 2024

Conversation

geekygnr
Copy link
Contributor

@geekygnr geekygnr commented May 2, 2024

Fixes #238

Documentation updates and makes drainpipe generate a phpcs.xml.dist instead of a phpcs.xml

@geekygnr geekygnr requested a review from davereid May 2, 2024 19:42
@github-actions github-actions bot temporarily deployed to pantheon-pr-562 May 2, 2024 19:45 Destroyed
"[project-root]/phpcs.xml": "scaffold/phpcs.xml"
"[project-root]/phpcs.xml.dist": "scaffold/phpcs.xml.dist"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we renamed an existing scaffolding file before? We have encountered errors with this on previous projects when the root project ends up having any kind of dependency or sub-dependency on composer/composer: https://www.drupal.org/project/drupal/issues/3266399

I'd like to make sure this is tested with a manual composer update to confirm it's okay to rename. It might be safer to leave the existing file in the source repository here and essentially have duplicate files, but only one listed in the scaffolding itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a bit of time to figure out how to test with the existing test framework. I have tested out what happens when the upgrade happens. I have tested upgrading and all it seems to do is create a phpcs.xml.dist file. Not seeing any errors.

tasks/test.yml Outdated
@@ -137,7 +137,7 @@ tasks:
desc: Runs PHPCS with Drupal Coding Standards
summary: |
Check your code against Drupal's coding standards. To override the default
ruleset, copy vendor/lullabot/drainpipe/scaffold/phpcs.xml to phpcs.xml
ruleset, copy vendor/lullabot/drainpipe/scaffold/phpcs.xml.dist to phpcs.xml.dist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ruleset, copy vendor/lullabot/drainpipe/scaffold/phpcs.xml.dist to phpcs.xml.dist
ruleset, copy vendor/lullabot/drainpipe/scaffold/phpcs.xml.dist to phpcs.xml

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this suggestion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The instructions are to copy the file to the same name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the same pattern that was there before I made the change. All I did was change the file name.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bit confusing, because .dist usually means "shipped with the project" not "local edits". I think phpcs.xml would be more canonical... but we should probably also automatically copy phpcs.xml.dist to the root of the repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused I thought the whole point of the ticket was to have drainpipe generate the projects phpcs.xml.dist instead of the phpcs.xml

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I'm confused because the instruction says "To override the default ruleset" in the beginning, which to mean assumes this is for a project-specific config file. I would assume the scaffolding file is being copied to the root of the project, which is what I see based on "[project-root]/phpcs.xml.dist": "scaffold/phpcs.xml.dist" being in the composer.json...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see... ya I don't know where my brain was at that day. Maybe that should be changed to direct the user to the readme because I don't see these instructions fitting into that.

@@ -681,6 +667,10 @@ Peer Reviewing by looking at PR code changes is nice.

Testing PR code changes on real sites is extra beneficial.

### Local Development
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A new heading, you'll need to run the command to update the table of contents in the file. We should really have a GitHub workflow that fails if this hasn't been updated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be kind of neat if github could rerun doctoc and then push a new commit. I can imagine other tools where we'd want to do something like that too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated the toc. Looks like #567 covers the suggested improvements.

@github-actions github-actions bot temporarily deployed to pantheon-pr-562 May 7, 2024 19:20 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-562 May 22, 2024 21:09 Destroyed
@github-actions github-actions bot temporarily deployed to pantheon-pr-562 May 22, 2024 21:16 Destroyed
Copy link
Member

@justafish justafish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@justafish justafish merged commit 0d15f38 into main May 22, 2024
36 checks passed
@justafish justafish deleted the 238--phpcs-scaffold branch May 22, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace phpcs.xml scaffold with phpcs.xml.dist
4 participants