数据驱动筛选以查找需要重构的源代码
项目描述
git异常值
数据驱动筛选以查找需要重构的源代码。
仍在开发中,尚未准备好使用。
介绍
运行 git-outlier 以查找适合重构的源代码文件。git-outlier 在 git 版本控制下的源代码目录中查找异常值,分为三类:复杂性、流失和组合复杂性和流失。最重要的文件值得进一步调查。
综合复杂性和流失异常值应该是重构的首选。复杂性和流失图分为四个相等的区域。除右上区域外,所有区域都可以;这些文件既复杂又经常更改。如果重构这些文件中的源代码,它们可能会更容易更改和维护。
源代码是按文件分析的,因此这要求您的项目包含多个源代码文件,其中逻辑实体位于单独的文件中,这样才有意义。
有不同的复杂性指标可用。选择对您最有意义的一种,或者两者都尝试。无论选择的复杂性指标如何,都是异常值的文件是重构的最佳候选者。
安装
最新版本应该可以通过 PyPI 获得。
[sudo] pip install git-outlier
用法
如果作为包安装,它应该可以直接在 git 中作为
git outlier
并使用与 python 脚本相同的选项。
可以使用以下选项运行 python 脚本。
usage: git_outlier.py [-h] [--languages LANGUAGES] [--metric METRIC] [--span SPAN] [--top TOP] [-v] [path]
Analyze a source directory that uses git as version handling system. The source files are analyzed for different type of
outliers and these outliers can be good candidates for refactoring to increase maintainability. The source files are
ranked in falling order after churn, complexity, and combined churn and complexity.
positional arguments:
path The path to the source directory to be analyzed. Will default to current directory if not present.
optional arguments:
-h, --help show this help message and exit
--languages LANGUAGES, -l LANGUAGES
List the programming languages you want to analyze. If left empty, it'll search for all
recognized languages. Example: 'outlier -l cpp -l python' searches for C++ and Python code. The
available languages are: c, cpp, csharp, fortran, go, java, javascript, lua, objective-c, php,
python, ruby, rust, scala, swift, typescript
--metric METRIC, -m METRIC
Choose the complexity metric you would like to base the results on. Either cyclomatic complexity
'CCN' or lines of code without comments 'NLOC'. If not specified, the default is 'CCN'.
--span SPAN, -s SPAN The number (integer) of months the analysis will look at. Default is 12 months.
--top TOP, -t TOP The number (integer) of outliers to show. Note that for the combined churn and complexity
outliers, there is no maximum. Default is 10.
-v, --verbose Show analysis details and debug info.
支持的语言
支持的语言
- C
- C++
- C#
- Fortran
- 去
- 爪哇
- JavaScript
- 卢阿
- 目标-c
- php
- Python
- 红宝石
- 锈
- 斯卡拉
- 迅速
- 打字稿
代码复杂度使用lizard计算。
参考
这个想法来自 Michael Feathers 的文章Getting Empirical about Refactoring。
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
git-outlier-0.0.2.tar.gz
(21.0 kB
查看哈希)
内置分布
git_outlier-0.0.2-py3-none-any.whl
(20.0 kB
查看哈希)
关
git_outlier -0.0.2-py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 51d18f2be82d92b4a5ac1b682fe4954596ac68781078f55dd368e68f41a036e1 |
|
| MD5 | 7c6f1aabe6d0c35880d764cec4ebad3b |
|
| 布莱克2-256 | a341c8c51a6b23883e35cb0d39e1383dbd5e9faf42ff2b93617baf6c6b18f6d7 |