From 1c5ba574b87f720dcb9be5aa089c5a1b28c69a9c Mon Sep 17 00:00:00 2001 From: naumso Date: Tue, 22 Jul 2025 19:46:34 +0300 Subject: [PATCH] init --- README.md | 66 ++++++++++++++++ composer.json | 25 ++++++ ruleset.xml | 206 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 297 insertions(+) create mode 100644 README.md create mode 100644 composer.json create mode 100644 ruleset.xml diff --git a/README.md b/README.md new file mode 100644 index 0000000..4a84256 --- /dev/null +++ b/README.md @@ -0,0 +1,66 @@ +# Sept coding standard + +We are using [PHP CodeSniffer][1] with the great [Symfony PHP CodeSniffer Coding Standard +of djoos][2] and some sniffs of [Slevomat Coding Standard][3], both adopted to our own needs. + + +## Goals of our coding standard + +* Using already existing standards (PSR-1, PSR-2, Symfony). +* Coding standard can be used across different projects. +* Avoid duplications (also between code, CVS history and documentation). +* Ensure code quality across different dev setups (e.g. different IDEs). + +## Installation + +If you use [Composer][4], you can install ProjektMOTOR Coding Standard in your project with the following +command: + +```BASH +composer require --dev 1sept/sept-coding-standard +``` + +Optional: To install coding standard automatically edit your composer script: + +```JSON + scripts: { + "post-install-cmd": [ + "@auto-scripts" + ], + "post-update-cmd": [ + "@auto-scripts" + ], + "auto-scripts": { + "phpcs --config-set installed_paths vendor/1sept/1sept-coding-standard/ProjektMOTORCodingStandard/": "script", + } + } +``` + +## Usage + +Just create a `phpcs.xml.dist` in your project's root directory with the following content: + +```xml + + + + + + + + + + + +``` + +And then you can execute the CodeSniffer like this: + + vendor/bin/phpcs -s -p --colors src/ + + +--- +[1]: https://github.com/squizlabs/PHP_CodeSniffer#readme +[2]: https://github.com/djoos/Symfony-coding-standard +[3]: https://github.com/slevomat/coding-standard +[4]: https://getcomposer.org/ \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c9a4648 --- /dev/null +++ b/composer.json @@ -0,0 +1,25 @@ +{ + "name": "1sept/sept-coding-standard", + "type": "phpcodesniffer-standard", + "description": "Internal PHP coding standard of Sept", + "keywords": ["coding standard", "phpcs", "psr", "code sniffer", "symfony"], + "homepage": "https://1sept.ru", + "license": "MIT", + "authors": [ + { + "name": "First September", + "homepage": "https://1sept.ru" + } + ], + "require": { + "slevomat/coding-standard": ">=8.19", + "squizlabs/php_codesniffer": "^3.0" + }, + "support" : { + "source": "https://git.1sept.ru/1sept/sept-coding-standard.git", + "issues": "https://git.1sept.ru/1sept/sept-coding-standard.git/issues" + }, + "conflict": { + "squizlabs/php_codesniffer": "<3 || >=4" + } +} \ No newline at end of file diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 0000000..8b16bb4 --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,206 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + src/ + tests/ + config/ + public/ + + ./src/Migrations/* + ./src/Kernel.php + ./public/index.php + ./config/bundles.php + ./config/bootstrap.php + ./config/preload.php + ./tests/features/bootstrap/bootstrap.php + ./tests/object-manager.php + ./tests/symfony-container.php + ./tests/bootstrap.php + + + + +