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

Ensure theme template headers in style.css has proper line breaks/spacing in it #191

Open
5 tasks
rebeccahum opened this issue Nov 30, 2018 · 0 comments
Open
5 tasks

Comments

@rebeccahum
Copy link

Basic Info -
Rule type: Error
Sniff Category: CoreFunctionality (I think?)

Having bad spacing/incorrect line breaks in the theme style.css "Template:" header will prevent a child theme from working properly.

Rule:

Couldn't find anything in the handbook but I found this: https://codex.wordpress.org/Theme_Development#Theme_Stylesheet

Theme check file covering this rule:

https://github.com/WordPress/theme-check/blob/da79a6f17b126b52998474cd234e4210de5a2d6f/checks/style_needed.php
https://github.com/WordPress/theme-check/blob/da79a6f17b126b52998474cd234e4210de5a2d6f/checks/style_suggested.php
Closest I could find ^^

[For new sniffs only] Code Samples:

// Code sample(s) which should pass.
/*
Template: test-dir/test-template
Version: 1.0
*/
// Code sample(s) which should be flagged by the sniff.
/*
Template: test-dir/test-template Version: 1.0
*/

When get_file_data() will try to parse the above, it will attempt to process the template as test-dir/test-template Version: 1.0 instead of test-dir/test-template

To do:

  • Add the rule in the Theme Review handbook to the Requirements page.
  • Create unit tests
  • Create new sniff
  • Adjust existing WPCS / PHPCS sniff and send in PR upstream.
  • Add existing sniffname sniff to the ruleset.
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

2 participants