WordPress / WordPress/WordPress-Coding-Standards

DirectoryName sniff ?

Open
#1,756 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Type: Enhancement
Dominant language
PHP
Stars
2.8k
Forks
521
Avg merge
5d 20h
Merged PRs (30d)
1

Description

The WP CS handbook has clear guidelines on filenames and these are covered by the WPCS FileName sniff.

However, what about directory names ?

Looking at the conventions used in WP Core, as well as in leading plugins, "lowercase, underscore dash-separated words" is the unofficial convention in the WP sphere.

Open Questions

  • Should this unofficial convention about directory names be formalized into a rule ?
  • If so, should we have a sniff checking this rule ?
    That is: checking for this for the directory path parts after the path to a project root: i.e. in the path path/to/project/src/admin/class-files/event/file.php, only the src, admin, class-files, and event parts would be checked.

Opinions welcome!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the WordPress CS handbook naming-conventions guidance and the existing WPCS FileName sniff. Use the issue's open questions to determine whether directory naming should be formalized and whether a sniff should check path parts after a project root. Done means an agreed convention and a defined implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.