wp-cli / scaffold-command

Generates code for post types, taxonomies, blocks, plugins, child themes, etc.
MIT License
165 stars 87 forks source link

wp scaffold and WPCS #109

Open sandrodz opened 6 years ago

sandrodz commented 6 years ago

Files generated by wp scaffold command are not WordPress coding standard compliant!

For example cpt generated:

screen shot 2017-12-22 at 3 39 29 pm

https://github.com/wp-cli/wp-cli/issues/4589

gitlost commented 6 years ago

Close via https://github.com/wp-cli/scaffold-command/pull/110

gitlost commented 6 years ago

Oops, maybe the other files apart from CPT aren't compliant?

Edit: no there're not - taxonomy for one.

Edit2: Taxonomy fixed now via https://github.com/wp-cli/scaffold-command/pull/112, need to check if there's others...

gziolo commented 6 years ago

@schlessera, @danielbachhuber - is there any Behat logic that would run linters on generated files? That would be great to ensure we scaffold files that are WordPress compliant.

schlessera commented 6 years ago

@gziolo No, but that would be a good addition. I'll create an issue for that.

gziolo commented 6 years ago

Awesome, thanks 🙇

thrijith commented 6 years ago

to keep track what else needs work

@gitlost @schlessera @gziolo I am checking commands I did that were merged

@gziolo you fixed scaffold block right?

gitlost commented 6 years ago

Good idea @thrijith !

gitlost commented 6 years ago

Going to remove this from the 1.1.2 milestone as incomplete at this late stage...

gziolo commented 6 years ago

@gziolo you fixed scaffold block right?

Yes, I fixed using Gutenberg's configuration. For PHP, it should be the same as core uses. JS part follows Eslint setup, but I hope it is similar to what JSHint promotes.

NicktheGeek commented 6 years ago

Looks like plugin and plugin-tests are mostly good to go. I did find an error generated on bootstrap.php. It is a false positive so I added a PR that uses a wpcs exclusion on the line to suppress the error.

ernilambar commented 4 months ago

Command wp scaffold post-type movie --label=Movie --theme=sample-theme

I used rules from the file we are distributing in scaffold - https://github.com/wp-cli/scaffold-command/blob/main/templates/.phpcs.xml.dist

Screenshot 2024-06-11 at 11 39 05 AM

Is it worth revisiting our scaffold snippets as in 6 years there has been lots of changes in the sniffer?

CC @wp-cli/committers

swissspidy commented 4 months ago

Seems reasonable to revisit this & implement some tests to ensure that the scaffolded code always passes PHPCS.