软件著作权代码提取60页制作Word

简单分享一个GitHub上开源的代码自动提取工具China software copyright extraction tool,使用说明其实仓库里已经写的很清楚了,虽然是英文,但翻译过来还是能够看得懂的。

顺便分享一个代码统计工具CLOC的使用,可用于代码行数的统计。


这里对Ramile进行简略的使用说明:

1.克隆仓库,或下载源码

软件著作权代码提取60页制作Word_第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 

解压完成后,extracted_code.docx会在你的项目根目录下生成一个名为的文件,3000行代码。您只需打开它并删除不必要的页面,即可使文档精确到 60 页。

如果你想严格满足规则,你可以通过附加Inf到命令行来提取所有行:

python ramile-cli.py extract  Inf

然后你只需要打开它并保留前 30 页和后 30 页,并删除所有中间页。

在这里插入图片描述
软件著作权代码提取60页制作Word_第2张图片
在这里插入图片描述

配置

如果需要自定义配置,需要将 .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

软件著作权代码提取60页制作Word_第3张图片

支持的语言

Language Extensions
JavaScript .js, .jsx, .vue, .wpy
Java .java
PHP .php
HTML .html, .htm
CSS .css, .less, .sass
Swift .swift
Objective-C .m

如果想扩展其它的语言,自己参照其它语言解析器的写法再补充相应的解析器就行,或者自己补充相应的扩展名

软件著作权代码提取60页制作Word_第4张图片

你可能感兴趣的:(项目,经验分享)