squizlabs / PHP_CodeSniffer

PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.
BSD 3-Clause "New" or "Revised" License
10.66k stars 1.48k forks source link

Suggestion: add a list with available external standards to the wiki #1165

Closed jrfnl closed 9 months ago

jrfnl commented 7 years ago

I was looking for a list of coding standards of well-known open source projects with an eco-system of add-on projects (plugins, themes), such as CakePHP, Drupal, Joomla, Magento, TYPO3, WordPress, preferably with links to the repo and possible link to a documented descriptive standard.

So far I have not been able to find such a list (found quite some standards, but took me hours).

Would it be an idea to add such a list of externally maintained standards which can be used with PHPCS as a wiki page to this repo ?

gsherwood commented 7 years ago

A directory of plugins, standards, and related projects is something I've considered a few times, but I know I don't have the time to build or maintain it, so I've never done it.

Ideally, it gets maintained by the community of developers who build on top of PHPCS, but that's a big ask of people as well, and I don't have the reach to actually communicate with all those people and bring them together. Ultimately, it feels like it would be outdated, and people would be submitting bug reports to this project when they find issues, so I'll end up having to maintain it anyway.

I'd love to be proved wrong, but right now I don't want to commit to something that I'm sure I can't deliver.

jrfnl commented 7 years ago

I appreciate that.

You could leave the burden of adding standards and keeping it up to date to the community with a editable-by-all wiki page. In that case, it would only need minor monitoring, but that could also be done by the community at large.

Hmm.. not sure if you can change the "publicly editable" setting per wiki page here...

gsherwood commented 7 years ago

Hmm.. not sure if you can change the "publicly editable" setting per wiki page here...

No, I don't think you can. Either the whole wiki is publicly editable, or only editable by people with push access to the main repo.

jrfnl commented 7 years ago

In that case, the only other thing I can think of would be to have a list at the bottom of the readme or in a separate .md file with a link in the readme. That would mean PRs to merge, but the community at large should be able to largely maintain the list that way (unfortunately that might mean some people posting issues about it too...)

aik099 commented 7 years ago

Another MD file with large large banner on top explaining, that each standard is maintained in corresponding repo and list of standards below sounds good.

gsherwood commented 7 years ago

A file would be ok I guess, but I'm not going to create it because it needs to be populated with content. I'll leave this idea open and see if anyone is interested in creating a directory. Step 1 would be posting the directory here.

jrfnl commented 7 years ago

Let this be a call for the community to add comments to this thread with:

N.B.: Please don't post links to Company standards/personal standards :heart_eyes:

Once we have a reasonable amount, I'll gladly set up the initial MD file.

So, to get started:

antograssiot commented 7 years ago

CakePHP coding standard Applies to: All PHP project, CakePHP core and plugin Handbook: https://book.cakephp.org/3.0/en/contributing/cakephp-coding-conventions.html Standard: https://github.com/cakephp/cakephp-codesniffer

jrfnl commented 6 years ago

Let's try and breath some life into this ticket again. Getting a directory of standards started still sounds useful to me.

So. here's another one:

Name: WordPress.com VIP coding standards Applies to: WordPress plugins and themes to be run on the wordpress.com VIP hosting platform. Handbook: https://vip.wordpress.com/documentation/code-review-what-we-look-for/ Standard: https://github.com/Automattic/VIP-Coding-Standards

Pinging @umherirrender @webimpress @photodude @klausi @TomasVotruba @illusori : I get the impression that each of you is involved with at least one external Application/CMS/Framework PHPCS standard. It would be great if you could add the relevant info to this thread! :heart:

TomasVotruba commented 6 years ago

Symplify Coding Standard

Applies to: Any Project with focus on Clean Code Handbook: https://www.tomasvotruba.cz/blog/2017/08/21/5-useful-rules-from-symplify-coding-standard/ Standard: https://github.com/Symplify/CodingStandard

@jrfnl Thanks for the ping, nice idea :+1:

TomasVotruba commented 6 years ago

Slevomat Coding Standard

Applies to: Safe behaviour of code, detecting dead code and consistent code looks Handbook: https://medium.com/@ondrejmirtes/slevomat-coding-standard-861267de576f Standard: https://github.com/slevomat/coding-standard

umherirrender commented 6 years ago

MediaWiki CodeSniffer Standards

Applies to: MediaWiki, MediaWiki extensions and skins Handbook: https://packagist.org/packages/mediawiki/mediawiki-codesniffer Standard: https://phabricator.wikimedia.org/diffusion/MCSN/repository/master/ - mirror at https://github.com/wikimedia/mediawiki-tools-codesniffer

illusori commented 6 years ago

I didn't create a style-standard plugin, I just created a plugin to analyse variable use and throw up some warnings for common mistakes with undefined variables/etc, it's more to detect code errors than style errors.

It's also unmaintained since I'm not working with PHP at the moment, so there's probably a fair chunk of code rot in there... it's up for grabs with my blessing if anyone wants to take it over (or even pull it into phpcs itself). It's fairly crufty code though.

But, for what it's worth:

PHP Codesniffer Variable Analysis

Applies to: Any code. Warns on common unintentional variable (ab)uses. Handbook: N/A Plugin: https://github.com/illusori/PHP_Codesniffer-VariableAnalysis

michalbundyra commented 6 years ago

ZendFramework Coding Standard (Work in Progress)

Applies to: all repositories in zendframework and zfcampus orgs Handbook: N/A (yet) Standard: https://github.com/zendframework/zend-coding-standard

I'm working on extending these standards for a while, and still I feel it's a long way to go. You can check https://github.com/zendframework/zend-coding-standard/pull/1 and ZF Forum. It's going to be library with very strict standards, as we would like to keep consistency across all repositories.

@jrfnl Thanks for pinging, I like your idea 😍

jrfnl commented 6 years ago

@TomasVotruba @umherirrender @illusori @webimpress Thanks for your responses! Please feel free to ping anyone else you know off maintaining a standard which should be on this list. Let's get this baby off the ground now :heart_eyes_cat:

TomasVotruba commented 6 years ago

@jrfnl Spreading the word: https://twitter.com/Pehapkari/status/912460804548648960

KacerCZ commented 6 years ago

Symfony PHP CodeSniffer Coding Standard

Applies to: Checks against Symfony coding standards Standard: https://github.com/djoos/Symfony-coding-standard

Developed by @djoos

photodude commented 6 years ago

Joomla Coding Standards

Applies to: Checks against Joomla Coding Standards

Joomla coding standard for PHPCS 2.8+ https://github.com/joomla/coding-standards a PHPCS 3.x version of the standard is in development but will not be primary until their projects are no longer supporting php5.3

jrfnl commented 6 years ago

@KacerCZ @photodude Thanks for adding to this thread! Please feel free to spread the word.

@photodude The PHPCompatibility standard is compatible with PHPCS 1.5.6, 2.x and 3.x, the WP Coding Standards are compatible with both PHPCS 2.x as well as 3.x. If Joomla would like to support multiple PHPCS versions as well and you'd like some pointers, feel free to ping me.

weierophinney commented 6 years ago

Zend Framework Coding Standard

Applies to: Zend Framework components Standard: https://github.com/zendframework/zend-coding-standard

Currently compatible with PHPCS 2.X and 3.X; we have a couple massive pull requests in place to add a ton more sniffs as well.

jrfnl commented 6 years ago

@weierophinney Nice! Thanks for adding it to the list. Please feel free to spread the word & invite more projects to add their standard. Other than that: how's life ? Hope you're well ;-)

louisl commented 6 years ago

CodeIgniter 4 Coding Standard

Applies to: CodeIgniter 4 Handbook: CodeIgniter 4 PHP Coding Style Guide Standard: CodeIgniter4-Standard

CodeIgniter 4 is in development so all of the above are subject to change prior to launch.

photodude commented 6 years ago

Doctrine Coding standard

https://github.com/doctrine/coding-standard

photodude commented 6 years ago

Slevomat Coding Standard

provides sniffs that fall into three categories:

https://github.com/slevomat/coding-standard

photodude commented 6 years ago

Totally missed that, Thanks @TomasVotruba ( Will delete soon to remove duplication )

jrfnl commented 9 months ago

Closing as replaced by PHPCSStandards/PHP_CodeSniffer#7