Comments Density
v0.3.0
PHP 소스 코드 파일의 댓글 밀도 및 품질을 분석하여 코드 문서 품질을 유지하고 개선하는 데 도움이됩니다.

주석 밀도 분석기를 설치하려면 터미널에서 다음 명령을 실행하십시오.
composer require --dev savinmikhail/comments-densityPHP 파일의 주석 밀도를 다음과 같이 분석하십시오.
php vendor/bin/comments_density analyze:comments다음과 함께 기준선을 생성합니다.
php vendor/bin/comments_density generate:baseline설치시 플러그인이 구성 파일을 만들 수 있습니다. Comment_Density.php 구성 파일을 편집하여 분석을 사용자 정의하십시오.
<?php
return [
' directories ' => [
' src ' , // Directories to be scanned for comments
],
' exclude ' => [
' src/DTO ' , // Directories to be ignored during scanning
],
' thresholds ' => [
// Limit occurrences of each comment type
' docBlock ' => 90 ,
' regular ' => 5 ,
' todo ' => 5 ,
' fixme ' => 5 ,
' missingDocBlock ' => 10 ,
// Additional metrics thresholds
' Com/LoC ' => 0.1 , // Comments per Lines of Code
' CDS ' => 0.1 , // Comment Density Score
],
' only ' => [
' missingDocblock ' , // Only this type will be analyzed; set to empty array for full statistics
],
' output ' => [
' type ' => ' console ' , // Supported values: 'console', 'html'
' file ' => ' output.html ' , // File path for HTML output (only used if type is 'html')
],
' missingDocblock ' => [
' class ' => true , // Check for missing docblocks in classes
' interface ' => true , // Check for missing docblocks in interfaces
' trait ' => true , // Check for missing docblocks in traits
' enum ' => true , // Check for missing docblocks in enums
' property ' => true , // Check for missing docblocks in properties
' constant ' => true , // Check for missing docblocks in constants
' function ' => true , // Check for missing docblocks in functions
' requireForAllMethods ' => true , // If false, only methods where @throws tag or generic can be applied will be checked
],
' use_baseline ' => true , // Filter collected comments against the baseline stored in comments_density.sqlite
];이 프로젝트는 Yegor Bugayenko에서 영감을 받았습니다. OpenSource 아이디어를 참조하십시오.
기부금을 환영합니다! 풀 요청을 제출하십시오.
이 라이브러리는 MIT 라이센스에 따라 릴리스됩니다.