DeepCodeAPI客户端(人工智能代码分析)
deepcode的Python项目详细描述
DeepCode的命令行界面
安装
最低支持的python版本是:3.6.5
安装PyPI
皮普:
pip install deepcode
诗歌:
^{pr2}$有关详细信息,请参见deepcode project on PYPI
本地安装包和开发模式
有关详细信息,请参阅development docs
命令行接口
deepcode --help Usage: deepcode [OPTIONS] COMMAND [ARGS]... A tool, that detects bugs and quality issues in JavaScript, TypeScript, Python, Java and C/C++. It uses a mighty engine based on AI from Deepcode. Options: -s, --service-url TEXT Custom DeepCode service URL (default: https://www.deepcode.ai) -a, --api-key TEXT Deepcode API key -c, --config-file FILE Config file (default: ~/.deepcode.json) --help Show this message and exit. Commands: analyze Analyzes your code using Deepcode AI engine. config Store configuration values in a file. login Initiate a new login protocol.
- 登录:这将打开一个浏览器窗口来登录DeepCode。
deepcode login
在 - 创建/更新配置:这将引导您完成一些配置步骤,以防您不想连接到
https://www.deepcode.ai但对于运行DeepCode实例的其他主机。
deepcode config
在 - 分析:对特定版本的代码进行分析。这将显示代码中存在的所有建议。在
Usage: deepcode analyze [OPTIONS]
Analyzes your code using Deepcode AI engine.
Exit codes:
0 - not issues found
1 - some issues found
2 - Execution was interrupted by the user
3 - Some error happened while executing
Options:
Source location: [mutually_exclusive, required]
The configuration of repository location
-p, --path DIRECTORY Path to folder to be processed. Multiple
paths are allowed
-r, --git-uri REMOTE Git URI (e.g.
git@<platform>:<owner>/<repo>.git@<oid> or
https://<platform>/<owner>/<repo>.git@<oid>)
-l, --with-linters Enable linters
-log, --log-file FILE Forward all debugging messages to a file
-txt, --result-text Present results in txt format
-sev, --severity [info|warning|critical]
Minimum severity level (default: info)
--help Show this message and exit.
示例:
deepcode analyze --path (<folder path one>) --path (<folder path two>) --with-linters --log-file=~/.deepcode.log -txt --severity warning deepcode analyze --path (<folder path one>) deepcode analyze --git-uri git@github.com:DefinitelyTyped/DefinitelyTyped.git --with-linters
json格式的分析结果,如here
Python本机用法
DeepCode CLI也可以作为一个模块使用,可以通过python导入系统导入到另一个python代码中。在
要使用这两个函数,请确保使用API键设置环境变量“DEEPCODE_API_KEY”,即can be obtained here
要使用Deepcode的自管理实例,请为其用户设置环境变量“Deepcode_SERVICE_URL”(例如https://example.org)
可用方法:
- 在
分析_文件夹(路径,linters_enabled=False):
在:param [paths] - Paths should be a list of absolute paths to bundle dir :param [linters_enabled] - optional. requests also linter analysis :return - dictionary with results e.g. as described [here](https://www.deepcode.ai/docs/REST%20APIs%2FBundles) plus: 'id' for bundle id and 'url' for online view of analysis results example: import deepcode deepcode.analyze_folders('<path to files dir>')
- 在
分析\u git(平台,所有者,repo,oid=None,linters_enabled=False):
在:param [platform] - github.com, bitbucket.org, gitlab.com. :param [owner] - repository account. (e.g. facebook) :param [repo] - repository. (e.g. react) :param [linters_enabled] - optional. requests also linter analysis :return - dictionary with results e.g. as described [here](https://www.deepcode.ai/docs/REST%20APIs%2FBundles) plus: 'id' for bundle id and 'url' for online view of analysis results example: import deepcode deepcode.analyze_git('github.com', 'facebook', 'react')
- 项目
标签: