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

Add composer and PHPCS for local linting #127

Merged
merged 10 commits into from
Sep 20, 2023
Merged

Conversation

cameronterry
Copy link
Contributor

Description of the Change

Cleans up the NPM scripts and adds PHPCS through Composer, enabling linting for PHP in addition to CSS and JS; my assumption being this would be useful longer term than removing the Composer references.

I've removed the composer install --no-dev -o && portion from npm run build-release but kept the other references in npm run lint and npm run lint-release, as it has PHPCS will now be available.

Running npm run lint-php or composer run lint returns:

> composer run lint

> ./vendor/bin/phpcs . -p -s
.... 4 / 4 (100%)


Time: 175ms; Memory: 16MB

Closes #116

How to test the Change

  1. Clone the repository.
  2. Switch to an appropriate Node/NPM version (if required).
  3. Run npm install.
  4. Run npm run build-release.
  5. And run npm run lint-php.
  6. And then run npm run lint (this seemingly runs into an issue seen in one of the build actions, https://github.com/10up/insecure-content-warning/actions/runs/5336668720/jobs/9671677686, which I think is related to this, Update node and NPM versions #114?)

Changelog Entry

Added - Composer, with PHPCBF and PHPCS to aid with coding standards.
Changed/Fixed - Possibly error from running npm run build-release.

Credits

Props @cameronterry

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@cameronterry cameronterry self-assigned this Jul 14, 2023
@cameronterry cameronterry requested a review from a team as a code owner July 14, 2023 10:23
@cameronterry cameronterry requested review from peterwilsoncc and removed request for a team July 14, 2023 10:23
@jeffpaul jeffpaul added this to the 1.2.0 milestone Jul 14, 2023
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

Added a few notes inline, mainly to make sure we ignore a few more things.

phpcs.xml Show resolved Hide resolved
.gitignore Show resolved Hide resolved
@github-actions github-actions bot added the needs:refresh This requires a refreshed PR to resolve. label Sep 11, 2023
@github-actions github-actions bot added needs:code-review This requires code review. and removed needs:refresh This requires a refreshed PR to resolve. labels Sep 14, 2023
@cameronterry
Copy link
Contributor Author

Thank you for the CR, @peterwilsoncc, and my apologies for the late reply and tardiness of some of the code: I've added both your suggestions and resolved the conflict with the most recent changes in the develop branch.

peterwilsoncc
peterwilsoncc previously approved these changes Sep 18, 2023
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

@cameronterry No need to apologise, we're all very busy. Thanks for the PR.

This LGMT

@peterwilsoncc
Copy link
Contributor

@jeffpaul @dkotter I'm unable to merge as it looks like some required actions have been removed/renamed or stalled.

@github-actions github-actions bot added the needs:refresh This requires a refreshed PR to resolve. label Sep 19, 2023
@jeffpaul
Copy link
Member

@peterwilsoncc I think I've resolved those blocking required actions, but looks like composer files have conflicts to resolve before merging.

@github-actions github-actions bot removed the needs:refresh This requires a refreshed PR to resolve. label Sep 19, 2023
Copy link
Contributor

@peterwilsoncc peterwilsoncc left a comment

Choose a reason for hiding this comment

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

@jeffpaul Conflicts have been resolved, tests are passing.

@peterwilsoncc peterwilsoncc merged commit 3e15a8a into develop Sep 20, 2023
10 checks passed
@peterwilsoncc peterwilsoncc deleted the feature/phpcs branch September 20, 2023 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-review This requires code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cleanup config files
3 participants