Making WordPress.org

Opened 10 months ago

Closed 10 months ago

Last modified 9 months ago

#7428 closed defect (bug) (fixed)

Warn for missing plugin name in Readme Parser

Reported by: rabmalin's profile rabmalin Owned by: dd32's profile dd32
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

In plugin readme, I believe plugin name in following three formats. If it is not matched then Parser should return some warning.

=== Plugin Name ===
# Plugin Name
Plugin Name
===

Currently if readme starts like this:

Contributors: rabmalin

Then parser takes Contributors: rabmalin as plugin name and continue parsing other headers.

Change History (6)

#1 @dd32
10 months ago

This is kind of intentional in a way, as we accept readme's to have invalid headers and really don't mind parsing it completely incorrectly if completely incorrect input is provided.

I can come up with many different variations of a readme that would fail parsing in one manner or another, and we can't really warn on all of them.

#2 @dd32
10 months ago

  • Owner set to dd32
  • Resolution set to fixed
  • Status changed from new to closed

In 13162:

Plugin Directory: Readme: Parse readme's that lack a plugin header.

Fixes #7428.

#3 @rabmalin
10 months ago

@dd32 Warning invalid_plugin_name_header is currently raised in two different cases. One is when plugin name is plugin name and another is when no header is found. Rather than using same warning key, may be different warning keys will help display messages in the client based on the condition. May be missing_plugin_name_header?

#4 @dd32
10 months ago

I think invalid_plugin_name_header is appropriate for both cases.

It's set to an invalid value, completely missing, empty string, or 'plugin name' are all just as useless as one another.

It's kind of pointless to have that as 3 different errors, it just makes it more difficult for an end user.

#5 @rabmalin
10 months ago

Ok. In that case may be we need to tweak the message in the validator to accommodate the changes.

Even if there is no heading, validator will display message like this.

We cannot find a plugin name in your readme. Plugin names look like: === Plugin Name ===. Please change Plugin Name to reflect the actual name of your plugin.

https://prnt.sc/D9LLtP6yE-Ef

#6 @dd32
9 months ago

In 13292:

Plugin Directory: Readme: Parse the first readme header when the readme contains a '=== Plugin Name ===' header.

Follow up to [13162].

See #7428.

Note: See TracTickets for help on using tickets.