plusforta/gitlab-rector
Composer 安装命令:
composer require --dev plusforta/gitlab-rector
包简介
Formatter artifacts rector for gitlab
关键字:
README 文档
README
A custom output formatter for Rector that generates GitLab Code Quality compatible reports.
Note: This is a maintained fork of vanta/gitlab-rector.
Install
- Run
composer require --dev plusforta/gitlab-rector - Edit your
rector.phpconfig and registerGitlabOutputFormatter
Configuration (Rector >= 1.0.1)
<?php
declare(strict_types=1);
use Rector\Config\RectorConfig;
use Rector\EarlyReturn\Rector\If_\ChangeNestedIfsToEarlyReturnRector;
use Rector\EarlyReturn\Rector\If_\RemoveAlwaysElseRector;
use PlusForta\Integration\Rector\GitlabOutputFormatter;
use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\ChangesReporting\Contract\Output\OutputFormatterInterface;
return RectorConfig::configure()
->withCache(
cacheDirectory: 'var',
cacheClass: FileCacheStorage::class
)
->withTypeCoverageLevel(10)
->withDeadCodeLevel(10)
->withPreparedSets(codeQuality: true, codingStyle: true)
->withAttributesSets(symfony: true, doctrine: true)
->withPaths([
__DIR__ . '/src',
])
->withRules([
ChangeNestedIfsToEarlyReturnRector::class,
RemoveAlwaysElseRector::class,
])
->registerService(GitlabOutputFormatter::class, 'gitlab', OutputFormatterInterface::class)
;
Usage in CI
lint-rector:
stage: lint
script:
- vendor/bin/rector --dry-run --output-format=gitlab > rector-report.json
artifacts:
reports:
codequality: rector-report.json
when: always
License
MIT
统计信息
- 总下载量: 108
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-17