簡單分享一個GitHub上開源的代碼自動提取工具Ramile,使用說明其實倉庫里已經寫的很清楚了,雖然是英文,但翻譯過來還是能夠看得懂的,
順便分享一個代碼統計工具CLOC的使用,可用于代碼行數的統計,
這里對Ramile進行簡略的使用說明:
1.克隆倉庫,或下載原始碼

2.安裝依賴項
要運行 Ramile 源代碼,需要安裝依賴項:pip install -r requirements.txt. 國內的話可以使用鏡子pip install -i https://pypi.mirrors.ustc.edu.cn/simple/ -r requirements.txt
(我這邊掛了代理安裝不成功,所以如果遇到安裝失敗的現象,可以嘗試關掉代理重新安裝試試)
3.運行
從源代碼運行:
python ramile-cli.py extract <path to your project root>
解壓完成后,extracted_code.docx會在你的專案根目錄下生成一個名為的檔案,3000行代碼,您只需打開它并洗掉不必要的頁面,即可使檔案精確到 60 頁,
如果你想嚴格滿足規則,你可以通過附加Inf到命令列來提取所有行:
python ramile-cli.py extract <path to your project root> Inf
然后你只需要打開它并保留前 30 頁和后 30 頁,并洗掉所有中間頁,



配置
如果需要自定義配置,需要將 .ramileconfig.json放在專案根檔案夾下,Ramile 會自動從專案根目錄加載組態檔,該檔案應為 json 格式,相關配置項如下:
| Key | Description | Default | Example |
|---|---|---|---|
| ignore | Sets the directories/files to be ignored by Ramile. “ignore” paths should be sub directories/files under source_root. Any directories/files starting with any one of the “ignore” items will be ignored. Wildcars are not supported. | [] | [‘Pods’, ‘libs’] |
| source_root | Overwrites the root directory of source codes to avoid Ramile process from the project root. | ‘’ | ‘app’ |
| filters | Sets the exclusive filters (which means, all other extensions will NOT be processed) for file extensions. By default all files will be processed. | [] | [’.js’, ‘.vue’] |
| lines_to_extract | Sets the total lines to extract | 3000 | 3000 |

支持的語言
| Language | Extensions |
|---|---|
| JavaScript | .js, .jsx, .vue, .wpy |
| Java | .java |
| PHP | .php |
| HTML | .html, .htm |
| CSS | .css, .less, .sass |
| Swift | .swift |
| Objective-C | .m |
如果想擴展其它的語言,自己參照其它語言決議器的寫法再補充相應的決議器就行,或者自己補充相應的擴展名

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/308894.html
標籤:其他
上一篇:安卓基本控制元件(TextView、ImageView)以及布局(線性布局、相對布局)的介紹
下一篇:Android系統啟動流程分析
