Comments Density
v0.3.0
Alat untuk menganalisis kepadatan komentar dan kualitas dalam file kode sumber PHP, membantu mempertahankan dan meningkatkan kualitas dokumentasi kode.

Untuk menginstal komentar penganalisa kepadatan, jalankan perintah berikut di terminal Anda:
composer require --dev savinmikhail/comments-densityMenganalisis kepadatan komentar dalam file PHP Anda dengan:
php vendor/bin/comments_density analyze:commentsMenghasilkan garis dasar dengan:
php vendor/bin/comments_density generate:baselinePada instalasi, Anda dapat mengizinkan plugin untuk membuat file konfigurasinya. Kustomisasi analisis Anda dengan mengedit file konfigurasi komentar_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
];Proyek ini terinspirasi oleh Yegor Bugayenko. Lihat Ide OpenSource.
Kontribusi dipersilakan! Silakan mengirimkan permintaan tarik.
Perpustakaan ini dirilis di bawah lisensi MIT.