dman-coders/drupal-code-metrics
Composer 安装命令:
composer require dman-coders/drupal-code-metrics
包简介
Performs analysis on Drupal project codebases to summarize code quality.
README 文档
README
Performs analysis on Drupal project codebases to summarize code quality
Built to run large-scale code analysis, this utility will build a database of all code files it scans, and then present analysis of what it found in various ways.
Usage
Overview
The process involves
- Indexing the available code folders. In this phase, folders and files are enumerated so that we know how many projects there are, and what the versions are etc. This info is built up and retained in a database that we interact with from now on.
- Scanning the indexed files for the various code quality metrics. This can be slow, so it runs as batch tasks, iterating through the items in the index and updating their summaries in the database.
- Reporting the progress of the scanning process and the summaries of the evaluations.
This uses Composer console, so commands are always of the form
path/to/dcm group:action
eg
dcm index:list sites/all/modules
dcm index:scan
dcm report:dump
Will index each module project within the sites/all/modules path of the site. It will first index all files and figure out the module folders within that tree On second run, it will start running the code sniffer over each module, and calculating ratings for it.
dcm --help
Displays the current list of commands and arguments.
Installation
This is a stand-alone tool that can be placed anywhere in your system and then linked to or called directly. The very quickest way to start is:
composer global require dman-coders/drupal-code-metrics:dev-master
With that done (it will pull in a lot of libraries) you can now run:
~/.composer/vendor/bin/dcm
I advise adding ~/.composer/vendor/bin/ to your $PATH permanently, as it's really really helpful to do that.
If you are not installing globally or modifying your $PATH yet, you will find the command in
./src/bin/dcm
This source code is now in ~/.composer/vendor/dman-coders/drupal-code-metrics/ for you to mess with.
Operations
Where possible, clean duplicate modules found on a system with the same version numbers will not be re-indexed. The main module+version index is site-wide. This is so the one tool can be run over dozens of unique sites somewhat efficiently.
Identifying module projects.
If a git checkout is found (such as a dev or submodule checkout) that git origin repository will be used as a unique identifier, and the git hash will be its 'version'. Most of the time however, a module project (tarball download) is identified by the presence of an info file.
Metrics
It leverages PHP CodeSniffer to find errors-per-file, and uses that as one metric.
PHPMessDedector is another scan that evaluates complexity.
It should use the Drupal "Hacked!" module also, to evaluate the amount of patches or the stability of some modules.
Using various ways of interpreting common Drupal Site installation patterns, it should be able to subdivide the found code into "contrib" vs "custom" and "patched", and report on that.
What is good code?
Some precepts this tool uses to create summaries:
- Less custom code is good. The proportion of 'special' code to supported modules tells us a lot about the maintainability of a site.
- Bad code style is a smell of bad code. /Although not conclusively provable/, the results of low scores in existing PHP integrity tests are highly correlated with technical debt, logical bugs, and are indicative of other code problems.
- Complexity metrics devised and used by the experts who study this topic full-time DO have merit
"Features" modules, which are largely autogenerated, are exempt from being labelled "custom code" and are usually a sign of good code discipline, so do not count against certain measures.
dman-coders/drupal-code-metrics 适用场景与选型建议
dman-coders/drupal-code-metrics 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「console」 「drupal」 「quality assurance」 「Static code analysis」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dman-coders/drupal-code-metrics 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dman-coders/drupal-code-metrics 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dman-coders/drupal-code-metrics 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This class provides you with an easy-to-use interface to progress bars.
A simple tool for checking that your PHP classes and methods use PHPDocs (PHP DocBlocks Checker fork).
A Laravel package to retrieve data from Google Search Console
Additional artisan commands for Laravel
Taptima PHP-CS-Fixer fixers
Provides an add-on purchasable entity.
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 29
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL
- 更新时间: 2015-04-14