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

class-copyright-notice-check.php failing for child theme #420

Open
EvanHerman opened this issue Feb 7, 2022 · 2 comments
Open

class-copyright-notice-check.php failing for child theme #420

EvanHerman opened this issue Feb 7, 2022 · 2 comments

Comments

@EvanHerman
Copy link

EvanHerman commented Feb 7, 2022

Parent Theme: https://wordpress.org/themes/primer/
Child Theme: https://wordpress.org/themes/ascension/

When running the theme check we're seeing errors saying a copyright notice could not be found for the theme.
image

I'm not sure why it's returning an error, as we do have a copyright notice inside of the readme.txt file and the style.css file.

https://github.com/godaddy-wordpress/primer-child-ascension/blob/develop/readme.txt#L62-L82
https://github.com/godaddy-wordpress/primer-child-ascension/blob/develop/style.css#L19

There are also copyright notices in the parent Primer theme readme.txt, and that passes the theme check without issue.
https://github.com/godaddy-wordpress/primer/blob/develop/readme.txt#L41-L64

When digging through the code it looks like the $paths var doesn't contain any paths to the child theme, but only paths to the parent theme.
image

Inside of the copyright-notice-check class file it looks like it's searching for a path to the child theme file, which isn't found and in turn returns a false error.
https://github.com/WordPress/theme-check/blob/master/checks/class-copyright-notice-check.php#L39-L46

// Get the contents of themeslug/filename:
foreach ( $combined_files as $path => $contents ) {
	if ( stripos( $path, $this->slug . '/readme.txt' ) ||
		stripos( $path, $this->slug . '/readme.md' ) ||
		stripos( $path, $this->slug . '/style.css' ) ||
		stripos( $path, $this->slug . '/licence.txt' ) !== false ) {
			$content .= $contents;
	}
}
@pattonwebz
Copy link
Member

You would be correct here - nearly all the checks are geared up to test the parent theme and child theme is barely (if at all) checked with the current code. We would have to refactor it pretty significantly to account for child themes in a good way.

Sorry for the confusion! If the theme allows you to upload it to the wordpress.org directory you should be ok.

@EvanHerman
Copy link
Author

Thanks @pattonwebz I appreciate the speedy response

EvanHerman added a commit to godaddy-wordpress/primer-child-ascension that referenced this issue Feb 7, 2022
fjarrett-godaddy pushed a commit to godaddy-wordpress/primer-child-ascension that referenced this issue Mar 15, 2022
* Update dependencies

* Update

* --allow-releaseinfo-change

* Use node 12

* Use node 12

* Use node 12

* Update

* Remove grunt install on theme-check

* Remove unsplash, add funtion

* Remove function

* Remove text-domain check from theme-check plugin

* Update

* Remove empty space

* Remove copyright check see: WordPress/theme-check#420

* Updates

* Update theme name in circleci config

* Update mins strings to ascension

* Remove Ascension from top of file

* Bump tested up to 5.9

* Reinstall proper grunt postcss. Fix gruntfile. Re-run grunt. Update dependencies to remove high and critical warnings.

* Regenerate package-lock.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants