From e9849dd8c71d4c0403b24ac81a311878ec11ac81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20A?= Date: Fri, 5 Aug 2022 10:29:04 +0200 Subject: [PATCH] DOC-5647 :: Feature Internal :: Include in HR linting for PHP (#114) DOC-5647 :: Feature Internal :: Include in HR linting for PHP (#114) --- docs/best-practices/code-style-lint.md | 45 ++++++++++++++++++++++++++ src/sidebars.js | 1 + 2 files changed, 46 insertions(+) create mode 100644 docs/best-practices/code-style-lint.md diff --git a/docs/best-practices/code-style-lint.md b/docs/best-practices/code-style-lint.md new file mode 100644 index 00000000..9c997544 --- /dev/null +++ b/docs/best-practices/code-style-lint.md @@ -0,0 +1,45 @@ +--- +title: Code Style and Linting +--- + +## Android + +@todo + +## iOS + +@todo + +## PHP + +### Code Style + +We are using [Prettier](https://prettier.io/) with the [Plugin Prettier PHP](https://github.com/prettier/plugin-php) +and this configuration in file `.prettierrc.json` to have exactly the same default configuration as Prettier: + +```json +{ + "phpVersion": "8.0", + "tabWidth": 2, + "braceStyle": "1tbs" +} +``` + +### Linting + +All code must be audited by all this tools: + +1. PHP Lint with the default configuration using command `php -l` +2. [Psalm](https://psalm.dev/) with configuration `errorLevel="1"` (the strictest level) +3. [PHPStan](https://phpstan.org/) with configuration `--level 9` (the strictest level) + +@todo This other tools are pending to implement also in Harmony PHP: + +1. [PHP Mess Detector](https://phpmd.org/), currently not compatible with the last version of PHP +2. [PHP_CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer), currently have some incompatibilities with Prettier +3. [Sonarlint](https://www.sonarlint.org/), currently it can be used for free in the IDE but not in the pipeline + + +## TypeScript + +@todo diff --git a/src/sidebars.js b/src/sidebars.js index 05037e96..e40ec9c2 100644 --- a/src/sidebars.js +++ b/src/sidebars.js @@ -116,6 +116,7 @@ module.exports = { "best-practices/git-standardization", "best-practices/pull-request-life-cycle-qa", "best-practices/code-review", + "best-practices/code-style-lint", "best-practices/dependency-injection", "best-practices/presenter-specs", "best-practices/angular",