Automattic / Automattic/woocommerce-services

Enforce phpcs linting rules before commit

Open
#2,377 3 comments 0 reactions 0 assignees View on GitHub
[Type] Technical Debt woocommerce-services
Dominant language
JavaScript
Stars
112
Forks
35
Avg merge
3d 1h
Merged PRs (30d)
14

Description

### Summary
Enforce our phpcs guideline https://github.com/Automattic/woocommerce-services/blob/develop/phpcs.xml.dist on any new changes going forward.

### Output
- Update pre-commit git hook to run phpcs
- Add phpcs linting as a new action to GitHub Action
- Fix all phpcs errors in `classes/*`
- Fix all phpcs errors in `woocommerce-services.php`
- Check with Woo core to see what/which rules we should be using? Why isn't wordpress.security part of woocommerce-sniffs?

### Impact
It will require us to fix all phpcs warning/errors on the entire file as long as it is modified.

Contributor guide

Open the contributing guide

Research direction

Start with phpcs.xml.dist, then inspect the existing pre-commit hook and GitHub Actions configuration to determine where linting belongs. Run PHPCS against classes/* and woocommerce-services.php, and consider the Woo core question about the applicable rules. Done means both checks run on changes and the listed files have no PHPCS errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, github-actions, php
Domain
ci-cd, developer-experience, tooling
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.