Skip to content

Commit de2e0f2

Browse files
committed
update standard
1 parent 663caec commit de2e0f2

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

developer/standard/coding.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Coding Standard
22

3-
The coding standard exists as good practice for keeping the syntax cohesive as possible.
3+
The coding standard exists as good practice for keeping the syntax cohesive as possible. We have created our own coding standard which can be automatic implemented in your project.
44

55
## Casing
66

77
* `PascalCase` for classes and interfaces
88
* `SCREAMING_SNAKE_CASE` for constants
9+
* `snake_case` for HTTP parameters, database columns
910
* `camelCase` for everything else
1011

11-
## Code Style
12+
## Code style
1213

1314
Code style is provided using [EasyCodingStandard](https://github.com/symplify/easy-coding-standard), defined at the root `ecs.php` file which extends [ecs-chevere.php](https://github.com/chevere/code-style/blob/main/.ecs/ecs-chevere.php).
1415

@@ -42,7 +43,6 @@ Create your `.ecs/ecs.php` [configuration](https://github.com/symplify/easy-codi
4243
declare(strict_types=1);
4344

4445
use Symplify\EasyCodingStandard\Config\ECSConfig;
45-
use Symplify\EasyCodingStandard\ValueObject\Option;
4646

4747
return static function (ECSConfig $ecsConfig): void {
4848
$ecsConfig->import(__DIR__ . '/ecs-chevere.php');
@@ -75,11 +75,33 @@ vendor/bin/ecs --config='.ecs/ecs.php' check file.php --fix
7575

7676
Check the workspace documentation to configure [automatic code formatting](../environment/workspace.md#coding-standards-formatting).
7777

78+
### Composer commands
79+
80+
Add the following scripts to your `composer.json` file:
81+
82+
```json
83+
{
84+
"scripts": {
85+
"cs:update": "mkdir -p .ecs && cd .ecs && curl -O https://raw.githubusercontent.com/chevere/code-style/main/.ecs/ecs-chevere.php",
86+
"ecs": "vendor/bin/ecs --config='.ecs/ecs.php'",
87+
"ecs:check": "composer ecs check",
88+
"ecs:fix": "composer ecs check --fix"
89+
}
90+
}
91+
```
92+
7893
## Typing
7994

80-
### Type Hinting
95+
### Type hinting
96+
97+
* All parameters, properties and return expressions **must** be type hinted
98+
99+
### Errors
100+
101+
Errors **must** be clear and concise, and must be evident where it came from.
81102

82-
* All parameters, properties and return expressions **should** be type hinted
103+
* Markdown format
104+
* One (1) line per error
83105

84106
## Code comments
85107

@@ -92,5 +114,5 @@ Comments in logic should be used only in the following cases:
92114

93115
DocBlock content should be **short** as possible, **relevant** and **omit** the obvious.
94116

95-
* Use markdown
96-
* `@param` and `@return` should be avoided (prefer typed code)
117+
* Markdown format
118+
* `@param` and `@return` should be avoided (prefer type hinting)

developer/standard/quality.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Our standard requires that code delivered by Chevere **must be**:
1313

1414
The code is continuously analyzed by many systems and third-party tools. All our packages will showcase a signature like this on the main `README.md` file:
1515

16-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=alert_status)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=security_rating)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=coverage)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=chevere_chevere&metric=sqale_index)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![CodeFactor](https://www.codefactor.io/repository/github/chevere/chevere/badge)](https://www.codefactor.io/repository/github/chevere/chevere)
16+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=alert_status)](https://sonarcloud.io/dashboard?id=chevere_workflow) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=chevere_workflow) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=chevere_workflow) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=security_rating)](https://sonarcloud.io/dashboard?id=chevere_workflow) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=coverage)](https://sonarcloud.io/dashboard?id=chevere_workflow) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=chevere_workflow&metric=sqale_index)](https://sonarcloud.io/dashboard?id=chevere_chevere) [![CodeFactor](https://www.codefactor.io/repository/github/chevere/chevere/badge)](https://www.codefactor.io/repository/github/chevere/chevere)
1717

1818
We use the following third-party CI services:
1919

@@ -25,7 +25,7 @@ We use the following third-party CI services:
2525

2626
All Chevere software **must** be tested.
2727

28-
To ensure the quality of the tests, all Chevere software requires **mutation testing**.
28+
To ensure the quality of the tests, code coverage is a **minimum** of 90%, and mutation testing is **required**.
2929

3030
## Well documented
3131

developer/standard/testing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Testing Standard
22

3-
## Testing Software
3+
## Software
44

5-
* Tests should be compatible with latest [PHPUnit](https://phpunit.de/) production release.\
5+
* Tests should be compatible with latest [PHPUnit](https://phpunit.de/) production release.
66
* Code coverage requires to install [pcov](https://github.com/krakjoe/pcov).
77

88
## Requirements

0 commit comments

Comments
 (0)