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

wp scaffold and WPCS #109

Open
sandrodz opened this issue Dec 22, 2017 · 12 comments
Open

wp scaffold and WPCS #109

sandrodz opened this issue Dec 22, 2017 · 12 comments

Comments

@sandrodz
Copy link

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

wp-cli/wp-cli#4589

@gitlost
Copy link
Contributor

gitlost commented Jan 8, 2018

Close via #110

@gitlost gitlost closed this as completed Jan 8, 2018
@gitlost gitlost added this to the 1.1.2 milestone Jan 8, 2018
@gitlost gitlost reopened this Jan 8, 2018
@gitlost
Copy link
Contributor

gitlost commented Jan 8, 2018

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

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

Edit2: Taxonomy fixed now via #112, need to check if there's others...

@gitlost gitlost removed this from the 1.1.2 milestone Jan 8, 2018
gitlost added a commit that referenced this issue Jan 11, 2018
fix wpcs in taxonomy generation
@gitlost gitlost added this to the 1.1.2 milestone Jan 11, 2018
@gziolo
Copy link
Contributor

gziolo commented Jan 12, 2018

@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
Copy link
Member

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

@gziolo
Copy link
Contributor

gziolo commented Jan 12, 2018

Awesome, thanks 🙇

@thrijith
Copy link
Member

thrijith commented Jan 16, 2018

to keep track what else needs work

  • wp scaffold _s
  • wp scaffold block -- marking as complete ( i couldn't find any errors )
  • wp scaffold child-theme
  • wp scaffold plugin
  • wp scaffold plugin-tests
  • wp scaffold post-type
  • wp scaffold taxonomy
  • wp scaffold theme-tests

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

@gziolo you fixed scaffold block right?

@gitlost
Copy link
Contributor

gitlost commented Jan 16, 2018

Good idea @thrijith !

gitlost added a commit that referenced this issue Jan 17, 2018
fix wpcs in child theme generation
@gitlost
Copy link
Contributor

gitlost commented Jan 27, 2018

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

@gitlost gitlost removed this from the 1.1.2 milestone Jan 27, 2018
gitlost added a commit that referenced this issue Jan 27, 2018
fix wpcs in plugin generation
@gziolo
Copy link
Contributor

gziolo commented Jan 28, 2018

@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.

gitlost added a commit that referenced this issue Feb 21, 2018
fix wpcs in theme-tests generation
@NicktheGeek
Copy link

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.

danielbachhuber pushed a commit that referenced this issue Nov 18, 2022
fix wpcs in cpt generation
danielbachhuber pushed a commit that referenced this issue Nov 18, 2022
fix wpcs in taxonomy generation
danielbachhuber pushed a commit that referenced this issue Nov 18, 2022
fix wpcs in child theme generation
danielbachhuber pushed a commit that referenced this issue Nov 18, 2022
fix wpcs in plugin generation
danielbachhuber pushed a commit that referenced this issue Nov 18, 2022
fix wpcs in theme-tests generation
@ernilambar
Copy link
Member

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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants