Skip to content

Commit 73d95e1

Browse files
ernilambarernilambardavidperezgarfrantorres
authored
Merge pull request #1142 from WordPress/make-markdown-file-check-case-insensitive
Make markdown file check case insensitive Co-authored-by: ernilambar <nilambar@git.wordpress.org> Co-authored-by: davidperezgar <davidperez@git.wordpress.org> Co-authored-by: frantorres <frantorres@git.wordpress.org>
2 parents 37a9896 + 6867ce7 commit 73d95e1

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

includes/Checker/Checks/Plugin_Repo/File_Type_Check.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,18 @@ protected function check_github_directory( Check_Result $result, array $files )
577577
* @param array $files List of file paths.
578578
*/
579579
protected function check_unexpected_markdown_files( Check_Result $result, array $files ) {
580-
$plugin_path = $result->plugin()->path();
581-
$allowed_root_md_files = array( 'README.md', 'readme.txt', 'LICENSE', 'LICENSE.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'SECURITY.md' );
582-
$root_md_files = array();
580+
$plugin_path = $result->plugin()->path();
581+
$allowed_root_md_files = array( 'README.md', 'readme.txt', 'LICENSE', 'LICENSE.md', 'CHANGELOG.md', 'CONTRIBUTING.md', 'SECURITY.md' );
582+
$allowed_root_md_files_lower = array_map( 'strtolower', $allowed_root_md_files );
583+
$root_md_files = array();
583584

584585
foreach ( $files as $file ) {
585586
$relative_path = str_replace( $plugin_path, '', $file );
586587
$relative_path = ltrim( $relative_path, '/' );
587588
$basename = basename( $file );
588589

589590
if ( substr_count( $relative_path, '/' ) === 0 && pathinfo( $file, PATHINFO_EXTENSION ) === 'md' ) {
590-
if ( ! in_array( $basename, $allowed_root_md_files, true ) ) {
591+
if ( ! in_array( strtolower( $basename ), $allowed_root_md_files_lower, true ) ) {
591592
$root_md_files[] = $file;
592593
}
593594
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Test Plugin
2+
3+
This plugin is for testing purposes.

0 commit comments

Comments
 (0)