Open main menu

Changes

add link, add plugin, fix link for CI
|text=Merge this article with the [[Coding Standards]] article.}}
When doing [[continuous integrationContinuous Integration]], or really any development process where you want to enforce a coding standard (aka coding conventions, or code style), you want to be able to do that automatically. You might have code reviews in your process, but you don't want engineers using eyeballs to check the syntax of code and brace style etc. -- that is so last century. Developer tools like [https://github.com/dsheiko/jscodesniffer jscodesniffer] or [https://github.com/squizlabs/PHP_CodeSniffer PHP CodeSniffer] can be used to clean up old inconsistent code.
While PHP CodeSniffer is great for PHP projects, you can use an '''EditorConfig''' file in your project which is [https://github.com/editorconfig/editorconfig/wiki/Projects-Using-EditorConfig supported natively by most leading IDEs and many open source projects] for all programming languages. See https://editorconfig.org/ on how to systematically define and enforce your coding style and syntactic standards.
== MediaWiki editorconfig ==
Here is an example of an editor config file. This is the one used by the MediaWiki project
* https://phabricator.wikimedia.org/source/mediawiki/browse/master/.editorconfig* https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/core/+/dbbe9661a7339bc9e235fb4bf728354f5a0f4541/.editorconfig
<syntaxhighlight lang=editorconfig>
root = true
trim_trailing_whitespace = false
</syntaxhighlight>
 
== Plugin for vim ==
Want a plugin for vim? https://github.com/editorconfig/editorconfig-vim
{{References}}