يساعد على اكتشاف المرشحين الجيدين لإعادة البناء.
churn-php عبارة عن حزمة تساعدك على تحديد ملفات php في مشروعك والتي قد تكون مرشحة جيدة لإعادة البناء. يقوم بفحص كل ملف PHP في المسار المقدم له و:
يتم عرض النتائج في جدول:

قد يكون الملف الذي يتغير كثيرًا وذو درجة تعقيد عالية مرشحًا أفضل لإعادة البناء من الملف الذي لا يتغير كثيرًا وذو درجة تعقيد منخفضة.
يساعد churn-php المطور فقط في تحديد الملفات لإعادة البناء. من الأفضل استخدام النتائج بالإضافة إلى حكمك الخاص لتحديد الملفات التي قد ترغب في إعادة هيكلتها.
قم بتنزيل الإصدار الأخير من churn.phar أو قم بتثبيته باستخدام Phive:
phive install churn يمكنك أيضًا تثبيت churn-php عبر Composer:
composer require bmitch/churn-php --devchurn run < one or more paths to source code > ...
churn run src
churn run src tests
# the command name can be skipped if directoriesToScan is set in churn.yml
churn يمكنك إضافة ملف churn.yml اختياري والذي يمكن استخدامه لتكوين churn-php. يمكن تخصيص موقع هذا الملف باستخدام خيار --configuration :
# Default: "churn.yml" or "churn.yml.dist"
churn run --configuration=config-dir/ < path >
churn run --configuration=my-config.yml < path > يبدو نموذج ملف churn.yml كما يلي:
# The maximum number of files to display in the results table.
# Default: 10
filesToShow : 10
# The minimum score a file need to display in the results table.
# Disabled if null.
# Default: 0.1
minScoreToShow : 0
# The command returns an 1 exit code if the highest score is greater than the threshold.
# Disabled if null.
# Default: null
maxScoreThreshold : 0.9
# The number of parallel jobs to use when processing files.
# Default: 10
parallelJobs : 10
# How far back in the VCS history to count the number of commits to a file
# Can be a human readable date like 'One week ago' or a date like '2017-07-12'
# Default: '10 Years ago'
commitsSince : One year ago
# Files to ignore when processing. The full path to the file relative to the root of your project is required.
# Also supports regular expressions.
# Default: All PHP files in the path provided to churn-php are processed.
filesToIgnore :
- src/Commands/ChurnCommand.php
- src/Results/ResultsParser.php
- src/Foo/Ba*
# File extensions to use when processing.
# Default: php
fileExtensions :
- php
- inc
# This list is used only if there is no argument when running churn.
# Default: <empty>
directoriesToScan :
- src
- tests/
# List of user-defined hooks.
# They can be referenced by their full qualified class name if churn has access to the autoloader.
# Otherwise the file path can be used as well.
# See below the section about hooks for more details.
# Default: <empty>
hooks :
- NamespaceMyHook
- path/to/my-hook.php
# The version control system used for your project.
# Accepted values: fossil, git, mercurial, subversion, none
# Default: git
vcs : git
# The path of the cache file. It doesn't need to exist before running churn.
# Disabled if null.
# Default: null
cachePath : .churn.cache إذا تم حذف ملف churn.yml أو تم حذف إعداد فردي، فسيتم استخدام القيم الافتراضية أعلاه.
يمكنك تكوين churn لإخراج النتيجة بتنسيقات مختلفة. التنسيقات المتاحة هي:
csvjsonmarkdowntext (الافتراضي) لاستخدام تنسيق مختلف، استخدم خيار --format . أمر مثال لـ json :
churn run --format json يسمح لك تكوين الخطافات بتخصيص churn .
يجب أن يقوم الخطاف المعرف من قبل المستخدم بتنفيذ واجهة ربط واحدة على الأقل:
| واجهة هوك | واجهة الحدث المقابلة |
|---|---|
| بعد التحليلHook | بعد التحليل |
| بعد تحليل الملفHook | بعد تحليل الملف |
| قبل أناليسيسهوك | قبل التحليل |
أسئلة وتعليقات وردود الفعل؟ @بميتش2112
composer test على PHP 7.1 والتأكد من اجتيازه.رخصة معهد ماساتشوستس للتكنولوجيا (MIT). يرجى الاطلاع على ملف الترخيص لمزيد من المعلومات.