Comments Density
v0.3.0
เครื่องมือในการวิเคราะห์ความหนาแน่นของความคิดเห็นและคุณภาพในไฟล์ซอร์สโค้ด PHP ช่วยในการรักษาและปรับปรุงคุณภาพเอกสารรหัส

ในการติดตั้งเครื่องวิเคราะห์ความหนาแน่นความคิดเห็นให้เรียกใช้คำสั่งต่อไปนี้ในเทอร์มินัลของคุณ:
composer require --dev savinmikhail/comments-densityวิเคราะห์ความหนาแน่นของความคิดเห็นในไฟล์ PHP ของคุณด้วย:
php vendor/bin/comments_density analyze:commentsสร้างพื้นฐานด้วย:
php vendor/bin/comments_density generate:baselineในการติดตั้งคุณสามารถอนุญาตให้ปลั๊กอินสร้างไฟล์การกำหนดค่า ปรับแต่งการวิเคราะห์ของคุณโดยการแก้ไขไฟล์การกำหนดค่า comments_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