core icon indicating copy to clipboard operation
core copied to clipboard

Follow a Coding Standard

Open szepeviktor opened this issue 3 years ago • 7 comments

composer require --dev wp-coding-standards/wpcs dealerdirect/phpcodesniffer-composer-installer
composer exec -- phpcs --standard=WordPress-Core src/ -s --exclude=WordPress.Files.FileName,WordPress.CodeAnalysis.AssignmentInCondition,Squiz.PHP.DisallowMultipleAssignments

These can be automatically fixed by phpcbf.

szepeviktor avatar Jul 08 '22 06:07 szepeviktor

Ok, let's give it a try.

I get ornery about WordPress's exact standards, but I know people find value in them, even if I think sometimes they make things worse than my own personal preferences & styles.

JJJ avatar Jul 13 '22 19:07 JJJ

but I know people find value in them

Who are those people? They are not industry professional who were raised by eating and drinking source code, but "particularly for those with vision difficulties" (from WPCS docs) and other slight disabilities.

So industry professionals MUST read code that targets people with disabilities. That is very HARD to do.

szepeviktor avatar Jul 13 '22 19:07 szepeviktor

💡 FYI TAB characters work really well on typewriters.

szepeviktor avatar Jul 13 '22 19:07 szepeviktor

.. so I've disabled all those things in WPCS and created https://github.com/szepeviktor/phpcs-psr-12-neutron-hybrid-ruleset

szepeviktor avatar Jul 13 '22 19:07 szepeviktor

@JJJ After running the above commands I've realized that WPCS is not compatible with your Descriptive Programming ©️

Many things get indented the way you don't want.

szepeviktor avatar Jul 13 '22 20:07 szepeviktor

Guess I should invent my own style, eh? 😓

JJJ avatar Jul 13 '22 20:07 JJJ

YES!!

szepeviktor avatar Jul 13 '22 20:07 szepeviktor