admin管理员组文章数量:1561811
开源项目 cognitive-complexity
使用教程
cognitive-complexityPHPStan rules to measure cognitive complexity of your classes and methods项目地址:https://gitcode/gh_mirrors/co/cognitive-complexity
1. 项目的目录结构及介绍
cognitive-complexity/
├── bin/
│ └── analyze.php
├── config/
│ ├── config.yaml
│ └── services.yaml
├── src/
│ ├── Analyzer/
│ │ └── CognitiveComplexityAnalyzer.php
│ ├── Command/
│ │ └── AnalyzeCommand.php
│ └── Utils/
│ └── FileReader.php
├── tests/
│ └── Analyzer/
│ └── CognitiveComplexityAnalyzerTest.php
├── vendor/
├── .gitignore
├── composer.json
└── README.md
bin/
: 包含项目的可执行文件。config/
: 包含项目的配置文件。src/
: 包含项目的源代码。Analyzer/
: 包含分析器类。Command/
: 包含命令行命令类。Utils/
: 包含工具类。
tests/
: 包含测试文件。vendor/
: 包含Composer依赖包。.gitignore
: Git忽略文件配置。composer.json
: Composer配置文件。README.md
: 项目说明文档。
2. 项目的启动文件介绍
bin/analyze.php
是项目的启动文件,负责初始化环境和执行分析命令。
#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
use Symfony\Component\Console\Application;
use TomasVotruba\CognitiveComplexity\Command\AnalyzeCommand;
$application = new Application();
$application->add(new AnalyzeCommand());
$application->run();
3. 项目的配置文件介绍
config/config.yaml
parameters:
source_directory: 'src'
output_file: 'cognitive_complexity_report.txt'
source_directory
: 指定源代码目录。output_file
: 指定输出报告文件。
config/services.yaml
services:
_defaults:
autowire: true
autoconfigure: true
public: false
TomasVotruba\CognitiveComplexity\Analyzer\CognitiveComplexityAnalyzer: ~
TomasVotruba\CognitiveComplexity\Command\AnalyzeCommand: ~
TomasVotruba\CognitiveComplexity\Utils\FileReader: ~
services
: 定义服务容器中的服务。CognitiveComplexityAnalyzer
: 分析器服务。AnalyzeCommand
: 命令行命令服务。FileReader
: 文件读取工具服务。
cognitive-complexityPHPStan rules to measure cognitive complexity of your classes and methods项目地址:https://gitcode/gh_mirrors/co/cognitive-complexity
本文标签: 开源项目教程CognitiveComplexity
版权声明:本文标题:开源项目 `cognitive-complexity` 使用教程 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dongtai/1727469707a1116075.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论