Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 3 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,10 @@ jobs:
TOKEN: ${{ secrets.EZROBOT_PAT }}
run: |
curl -H "Authorization: token $TOKEN" -L https://github.com/ibexa/vale-styles/archive/refs/heads/main.zip -o vale.zip
unzip vale.zip
unzip vale.zip -d vale
rm vale.zip
mv vale-styles-main/* vale-styles-main/.vale.ini .
rm -rf vale/vale-styles-main/tests
mv vale/vale-styles-main/* vale/vale-styles-main/.vale.ini .
- name: Run Vale.sh
uses: vale-cli/vale-action@v2
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/code_samples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@ jobs:
continue-on-error: true
run: composer check-rector

- name: Run YAML snippet tests
id: check-yaml
continue-on-error: true
run: composer check-yaml

- name: Fail job if any check failed
if: always()
run: |
if [[ "${{ steps.phpstan.outcome }}" == "failure" || "${{ steps.deptrac.outcome }}" == "failure" || "${{ steps.rector.outcome }}" == "failure" ]]; then
echo "One or more checks failed: PHPStan=${{ steps.phpstan.outcome }}, Deptrac=${{ steps.deptrac.outcome }}, Rector=${{ steps.rector.outcome }}"
if [[ "${{ steps.phpstan.outcome }}" == "failure" || "${{ steps.deptrac.outcome }}" == "failure" || "${{ steps.rector.outcome }}" == "failure" || "${{ steps.check-yaml.outcome }}" == "failure" ]]; then
echo "One or more checks failed: PHPStan=${{ steps.phpstan.outcome }}, Deptrac=${{ steps.deptrac.outcome }}, Rector=${{ steps.rector.outcome }}, YAML=${{ steps.check-yaml.outcome }}"
exit 1
fi
code-samples-inclusion-check:
name: Check code samples inclusion
runs-on: ubuntu-latest
Expand All @@ -94,7 +100,7 @@ jobs:
- name: Log target branch code_samples usage
if: steps.list.outputs.CODE_SAMPLES_CHANGE != ''
run: |
git fetch origin
git fetch origin --depth=1 ${{ github.head_ref }}
git checkout origin/${{ github.head_ref }} -- tools/code_samples/code_samples_usage.php
php tools/code_samples/code_samples_usage.php ${{ steps.list.outputs.CODE_SAMPLES_CHANGE }} > $HOME/code_samples_usage_target.txt
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ auth.json
yarn.lock
docs/css/*.map
.deptrac.cache
.phpunit.result.cache
code_samples/_inline_php/
15 changes: 15 additions & 0 deletions .php-cs-fixer-factory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;

$commonRules = [
'header_comment' => false,
];

return [new InternalConfigFactory(), $commonRules];
29 changes: 29 additions & 0 deletions .php-cs-fixer-inline.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

/**
* PHP-CS-Fixer configuration for auto-generated inline snippets in code_samples/_inline_php/.
*
* Builds on top of the shared factory with additional rule overrides:
* - psr_autoloading is disabled: snippet files are named line_N.php and do not
* correspond to any class, so the filename≠class-name rule does not apply.
*/
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory->withRules(array_merge($commonRules, [
'psr_autoloading' => false,
'AdamWojs/phpdoc_force_fqcn_fixer' => false,
]));

return $configFactory
->buildConfig()
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/code_samples/_inline_php')
->files()->name('*.php')
);
8 changes: 3 additions & 5 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@
*/
declare(strict_types=1);

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;
[$configFactory, $commonRules] = require __DIR__ . '/.php-cs-fixer-factory.php';

$configFactory = new InternalConfigFactory();
$configFactory->withRules([
'header_comment' => false,
]);
$configFactory->withRules($commonRules);

return $configFactory
->buildConfig()
Expand All @@ -23,5 +20,6 @@
__DIR__ . '/tests',
], 'is_dir')
)
->exclude('_inline_php') // handled separately by .php-cs-fixer-inline.php
->files()->name('*.php')
);
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@ of the command.

## Testing the code samples

### YAML configuration

To test the YAML configuration, run the following commands:

``` bash
composer update
composer check-yaml
```

To add an error into a baseline, run `composer yaml-update-baseline` and commit the result.
Error added to the baseline are not reported again.

### markdownlint

This repository uses [markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2) to check Markdown formatting, including table syntax.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
: 'The user is not assigned to the segment.'
));

$this->segmentationService->removeSegmentGroup($segmentGroup);

return self::SUCCESS;
}
}
1 change: 0 additions & 1 deletion code_samples/back_office/components/twig_components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ibexa_twig_components:
priority: 0
arguments:
content: '<b>Hello world!</b>'
admin-ui-user-menu:
duplicated_user_menu:
type: menu
arguments:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ framework:
to:
- dropped

// ...
# ...

ibexa:
repositories:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
$domain: <translation_domain>
tags:
- { name: ibexa.payment.payment_method.type, alias: new_payment_method_type }
services:

App\Payment\PaymentMethod\Voter\NewPaymentMethodTypeVoter:
tags:
- { name: ibexa.payment.payment_method.voter, type: new_payment_method_type }
- { name: ibexa.payment.payment_method.voter, type: new_payment_method_type }
2 changes: 1 addition & 1 deletion code_samples/mcp/config/packages/mcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ibexa:
discovery_cache: cache.tagaware.filesystem
session:
type: psr16
directory: cache.tagaware.filesystem
service: cache.tagaware.filesystem
system:
default:
mcp:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ ibexa:
<scope>:
connector_raptor:
enabled: true
customer_id: ~ # Required
customer_id: "12345" # Required
tracking_type: client # One of: "client" or "server"

# Raptor Recommendations API key
recommendations_api_key: ~ # Required
recommendations_api_key: "your_api_key_here" # Required

# Raptor Recommendations API URL, optional, set by default
recommendations_api_url: '%ibexa.connector.raptor.recommendations.api_url%'
# Raptor Recommendations API URI, optional, set by default
recommendations_api_uri: '%ibexa.connector.raptor.recommendations.api_uri%'

# Cookie lifetime in days for server-side tracking identifier
# Default: 365 days. Minimum: 1 day.
Expand Down
49 changes: 41 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"type": "library",
"license": "GNU General Public License v2.0",
"autoload-dev": {
"psr-4": {
"Ibexa\\Tests\\Documentation\\": "tests/"
}
},
"repositories": [
{
Expand All @@ -15,6 +18,9 @@
"php": "^8.3"
},
"require-dev": {
"phpunit/phpunit": "^11.0",
"symfony/yaml": "^7.0",
"ibexa/connector-gemini": "5.0.x-dev",
"ibexa/automated-translation": "5.0.x-dev",
"ibexa/code-style": "~2.0.0",
"friendsofphp/php-cs-fixer": "^3.30",
Expand Down Expand Up @@ -52,7 +58,7 @@
"ibexa/page-builder": "5.0.x-dev",
"ibexa/order-management": "5.0.x-dev",
"ibexa/calendar": "5.0.x-dev",
"ibexa/payment": "5.0.x-dev",
"ibexa/payment": "~5.0.x-dev",
"ibexa/shipping": "5.0.x-dev",
"ibexa/fieldtype-matrix": "5.0.x-dev",
"ibexa/storefront": "5.0.x-dev",
Expand Down Expand Up @@ -86,21 +92,48 @@
"ibexa/cdp": "~5.0.x-dev",
"ibexa/connector-raptor": "~5.0.x-dev",
"ibexa/image-editor": "~5.0.x-dev",
"ibexa/integrated-help": "~5.0.x-dev"
"ibexa/integrated-help": "~5.0.x-dev",
"ibexa/site-context": "~5.0.x-dev",
"ibexa/fieldtype-richtext-rte": "~5.0.x-dev",
"ibexa/site-factory": "~5.0.x-dev",
"ibexa/ckeditor-premium": "~5.0.x-dev",
"ibexa/measurement": "~5.0.x-dev",
"ibexa/connector-actito": "~5.0.x-dev",
"ibexa/fastly": "~5.0.x-dev"
},
"scripts": {
"fix-cs": "php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
"check-cs": "@fix-cs --dry-run",
"phpstan": "phpstan analyse",
"deptrac": "deptrac analyse",
"check-rector": "rector process --dry-run --ansi"
"fix-cs": [
"php tools/extract-inline-php.php",
"php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots",
"php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots",
"php tools/sync-inline-php-to-markdown.php"
],
"check-cs": [
"php tools/extract-inline-php.php",
"php-cs-fixer fix --config=.php-cs-fixer.php -v --show-progress=dots --dry-run",
"php-cs-fixer fix --config=.php-cs-fixer-inline.php -v --show-progress=dots --dry-run"
],
"phpstan": "php tools/extract-inline-php.php && phpstan analyse",
"deptrac": "php tools/extract-inline-php.php && deptrac analyse",
"fix-rector": [
"php tools/extract-inline-php.php",
"rector process --ansi",
"php tools/sync-inline-php-to-markdown.php"
],
"check-rector": "php tools/extract-inline-php.php && rector process --dry-run --ansi",
"check-yaml": "phpunit --group yaml",
"phpunit": "phpunit --exclude-group=yaml",
"yaml-update-baseline": "php tests/generate-yaml-baseline.php"
},
"scripts-descriptions": {
"fix-cs": "Automatically fixes code style in all files",
"check-cs": "Run code style checker for all files",
"phpstan": "Run static code analysis",
"deptrac": "Run Deptrac architecture testing",
"check-rector": "Check for code refactoring opportunities"
"fix-rector": "Automatically applies Rector refactoring to code samples and syncs back to Markdown",
"check-rector": "Check for code refactoring opportunities",
"check-yaml": "Run PHPUnit tests (YAML validation)",
"yaml-update-baseline": "Regenerate tests/yaml-validation-baseline.yaml from current failures"
},
"config": {
"allow-plugins": false
Expand Down
23 changes: 23 additions & 0 deletions deptrac.baseline.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
deptrac:
skip_violations:
AcmeFeatureBundle:
- Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension
App\AutomatedTranslation\ImageFieldEncoder:
- Ibexa\Core\FieldType\Image\Value
App\Block\Listener\MyBlockListener:
Expand Down Expand Up @@ -92,6 +94,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RelationController:
- Ibexa\Core\MVC\Symfony\View\View
App\Controller\RideController:
- Ibexa\Bundle\Core\Controller
- Ibexa\Core\MVC\Symfony\View\ContentView
App\Controller\SvgController:
- Ibexa\Core\Helper\TranslationHelper
- Ibexa\Core\IO\IOServiceInterface
Expand Down Expand Up @@ -130,13 +135,19 @@ deptrac:
- Ibexa\FormBuilder\Event\FormEvents
App\EventSubscriber\HelpMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
App\EventSubscriber\LoginFormViewSubscriber:
- Ibexa\Core\MVC\Symfony\Event\PreContentViewEvent
- Ibexa\Core\MVC\Symfony\MVCEvents
- Ibexa\Core\MVC\Symfony\View\LoginFormView
App\EventSubscriber\MyMenuSubscriber:
- Ibexa\AdminUi\Menu\Event\ConfigureMenuEvent
- Ibexa\AdminUi\Menu\MainMenuBuilder
App\EventSubscriber\NotificationScenarioSubscriber:
- Ibexa\IntegratedHelp\ProductTour\Block\LinkBlock
- Ibexa\IntegratedHelp\ProductTour\Block\TextBlock
- Ibexa\IntegratedHelp\ProductTour\ProductTourStep
App\EventSubscriber\ResolveCampaginEventSubscriber:
- Ibexa\ConnectorActito\Campaign\Campaign
App\Event\RandomBlockListener:
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\BlockRenderEvents
- Ibexa\FieldTypePage\FieldType\Page\Block\Renderer\Event\PreRenderEvent
Expand Down Expand Up @@ -194,6 +205,8 @@ deptrac:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\Migrations\Step\ReplaceNameStepNormalizer:
- Ibexa\Migration\ValueObject\Step\StepInterface
App\MyService:
- Ibexa\Core\MVC\Symfony\SiteAccess\SiteAccessServiceInterface
App\Notification\ListRenderer:
- Ibexa\Core\Notification\Renderer\NotificationRenderer
- Ibexa\Core\Notification\Renderer\TypedNotificationRendererInterface
Expand All @@ -212,6 +225,8 @@ deptrac:
App\QueryType\OptionsBasedLatestContentQueryType:
- Ibexa\Core\QueryType\OptionsResolverBasedQueryType
- Ibexa\Core\QueryType\QueryType
App\QueryType\RideQueryType:
- Ibexa\Core\QueryType\QueryType
App\Search\Model\Suggestion\ProductSuggestion:
- Ibexa\ProductCatalog\Local\Repository\Values\Product
App\Security\FormPolicyProvider:
Expand All @@ -236,6 +251,8 @@ deptrac:
- Ibexa\AdminUi\Limitation\LimitationValueMapperInterface
App\Security\MyPolicyProvider:
- Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider
App\Service\MyService:
- Ibexa\User\UserSetting\DateTimeFormat\FormatterInterface
App\Setting\Group\MyGroup:
- Ibexa\User\UserSetting\Group\AbstractGroup
App\Setting\Unit:
Expand All @@ -254,3 +271,9 @@ deptrac:
- Ibexa\Core\MVC\Symfony\View\View
AttributeTypeExtension:
- Ibexa\PageBuilder\Form\Type\Attribute\AttributeType
CustomRepositoryConfigParser:
- Ibexa\Bundle\Core\DependencyInjection\Configuration\RepositoryConfigParserInterface
JohnDoeCanSelectMore:
- Ibexa\AdminUi\UniversalDiscovery\Event\ConfigResolveEvent
MyMapper:
- Ibexa\ContentForms\Form\Type\FieldType\CheckboxFieldType
Loading
Loading