Skip to content

Conversation

@jasonkenison
Copy link

@jasonkenison jasonkenison commented Aug 26, 2025

Related to #1722
Continuing updates from #2492

  1. Grouped all checks into individual standards.
  2. Included additional standards not previously included
  3. Added more check valid and invalid examples

Closes #2492

@jrfnl jrfnl changed the title Docs/word press/files/file name standard [Update] Documentation for sniff WordPress.Files.FilesName Aug 26, 2025
@jrfnl jrfnl mentioned this pull request Aug 26, 2025
61 tasks
Copy link
Collaborator

@rodrigoprimo rodrigoprimo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this PR, @jasonkenison! I left some comments with suggestions. Let me know if you have any questions.

<code title="Valid: Lowercase and `-` separators.">
<![CDATA[
taxonomy<em>-</em>my<em>-</em>term.inc
<em>s</em>ome<em>f</em>ile.inc
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering the invalid example related to this one, I believe the valid example should separate the two words with a hyphen, no? This would also fix the error in CI that is a false positive in my opinion, as ome is incorrectly being flagged as a typo.

Suggested change
<em>s</em>ome<em>f</em>ile.inc
some<em>-</em>file.inc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigoprimo these were tricky, was trying to highlight where non-lowercase letters were used. To get past the spelling error, it now highlights <em>Some</em> as a complete word instead of just the character.

Copy link
Collaborator

@rodrigoprimo rodrigoprimo Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the valid examples of the first two errors, as they check if the whole name matches what is expect, maybe we can highlight the full name (excluding the period and the file extension)?

For the third error, I think it is better to highlight just -template as it is already the case.

For the invalid examples, I think you could highlight just the part that is causing the error.

@rodrigoprimo
Copy link
Collaborator

@jasonkenison, I was just wondering if you'll have a chance to finish this off in the near future. It would be great if this PR could be included in the next WPCS release.

If you haven't got time or lost interest, please let us know and we'll see if we can find someone to take over. Thanks!

Comment on lines 32 to 45
<code_comparison>
<code title="Valid: File name matches prefix and class.">
<![CDATA[
<em>class-bulk-updater</em>.php // For a class named `Bulk_Updater`.
]]>
</code>
<code title="Invalid: File name missing prefix or class.">
<![CDATA[
class<em>.</em>bulk-updater.php
<em>bulk-updater</em>.php
bulk-updater<em>-class</em>.php
]]>
</code>
</code_comparison>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigoprimo I'm not sure how to solve this one, but am happy to discuss or try recommendations.

Regarding your question here, this is more or less what I have in mind. What do you think?

Suggested change
<code_comparison>
<code title="Valid: File name matches prefix and class.">
<![CDATA[
<em>class-bulk-updater</em>.php // For a class named `Bulk_Updater`.
]]>
</code>
<code title="Invalid: File name missing prefix or class.">
<![CDATA[
class<em>.</em>bulk-updater.php
<em>bulk-updater</em>.php
bulk-updater<em>-class</em>.php
]]>
</code>
</code_comparison>
<code_comparison>
<code title="Valid: File name matches class name with proper prefix.">
<![CDATA[
<em>class-bulk-updater</em>.php // `Bulk_Updater`.
<em>class-user-profile</em>.php // `User_Profile`.
<em>class-export-data</em>.php // `Export_Data`.
]]>
</code>
<code title="Invalid: File name does not match class name or the prefix is incorrect.">
<![CDATA[
class-<em>update-in-bulk</em>.php // `Bulk_Updater`.
<em></em>user-profile.php // `User_Profile`.
<em>class.</em>export-data.php // `Export_Data`.
]]>
</code>
</code_comparison>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rodrigoprimo Change made in the latest commit

@rodrigoprimo
Copy link
Collaborator

@jasonkenison, I reacted with 👍 in the last comment of all the conversations where you already addressed my suggestion. When you have a moment, could you please resolve those? I also replied to your question and provided an example.

I believe there is still one comment that was not addressed: #2590 (comment)

Thanks for your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants