From a0729245c277ba2972bd82a18324b6925fd49ca7 Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Thu, 19 Mar 2026 14:09:01 +0100 Subject: [PATCH] Check if readme file is empty --- checks/class-file-check.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/checks/class-file-check.php b/checks/class-file-check.php index e74af897..f22509be 100644 --- a/checks/class-file-check.php +++ b/checks/class-file-check.php @@ -67,6 +67,7 @@ public function check( $php_files, $css_files, $other_files ) { ); $musthave = array( 'index.php', 'style.css', 'readme.txt' ); + $readme = null; $fse_find = array_filter( array_keys( $other_files ), @@ -123,6 +124,24 @@ function( $file_name ) { ); $ret = false; } + + if ( 'readme.txt' === $file ) { + foreach ( $other_files as $other_path => $other_content ) { + if ( 'readme.txt' === strtolower( basename( $other_path ) ) ) { + $readme = $other_content; + break; + } + } + } + } + + if ( null !== $readme && '' === trim( $readme ) ) { + $this->error[] = sprintf( + '%s: %s', + __( 'REQUIRED', 'theme-check' ), + __( 'The readme.txt file is empty.', 'theme-check' ) + ); + $ret = false; } return $ret;