博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
如何进行代码审查?
阅读量:2064 次
发布时间:2019-04-29

本文共 4049 字,大约阅读时间需要 13 分钟。

Phabricator是一个代码审查管理,Arcanist是Phabricator配套的Code Review工具,需要配合本地git使用。

安装环境:

确认PHP是否已经安装

Mac OS X应该已经默认安装了PHP环境。在终端中输入php -v检查是否已安装了PHP环境。

liuhaihua@liuhaihuadeMacBook-Pro jwordpress % php -vPHP 7.3.11 (cli) (built: Dec 13 2019 19:21:21) ( NTS )Copyright (c) 1997-2018 The PHP GroupZend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

安装Arcanist在计划安装目录签出Arcanist代码仓库 

git clone https://github.com/phacility/libphutil.git git clone https://github.com/phacility/arcanist.git 

配置arc的环境变量 

输入

 cd ~

输入命令行:

open -e .bash_profile

会自动弹出 .bash_profile 文件的编辑窗口,在配置文件的末尾加上这一句 

export PATH=${PATH}:/路径/arcanist/bin/ 

输入命令行:source .bash_profile 更新更配置的环境变量。  然后输入命令:arc –help 查看配置是否成功。

配置项目 

打开终端,切换到项目所在目录,运行arc install-certificate,按提示添加访问token 

liuhaihua@liuhaihuadeMacBook-Pro JWordpress % arc diffUsage Exception: This command requires arc to connect to a Phabricator install, but noPhabricator installation is configured. To configure a Phabricator URI:  - set a default location with `arc set-config default 
`; or  - specify `--conduit-uri=uri` explicitly; or  - run `arc` in a working copy with an '.arcconfig'.liuhaihua@liuhaihuadeMacBook-Pro JWordpress % vi .arcconfigliuhaihua@liuhaihuadeMacBook-Pro JWordpress % arc diff     Usage Exception: YOU NEED TO AUTHENTICATE TO CONTINUEYou are trying to connect to a server (phabricator.59et.com) that you do not have any credentials stored for.To retrieve and store credentials for this server, run this command:      $ arc install-certificateliuhaihua@liuhaihuadeMacBook-Pro JWordpress % arc install-certificate CONNECT  Connecting to "http://phabricator.59et.com/api/"...LOGIN TO PHABRICATOROpen this page in your browser and login to Phabricator if necessary:http://phabricator.59et.com/conduit/login/Then paste the API Token on that page below.    Paste API Token from that page: xxxxxxxxxxxxxxxWriting ~/.arcrc... SUCCESS!  API Token installed.

代码审查流程 

在本地独立开发分支提交改动代码。有对应的Manifest Task时,改动需要在同名分支下提交。  执行arc diff。第一次执行时需要配置默认的比较目标,默认为origin/master,可以按需修改为origin/develop,或执行arc diff [分支名]来显示指定  在弹出的文本编辑器中填写Title、Summary和Reviewer,保存并关闭  等待审查通过,如果审查失败的话,可修改代码并重新执行arc diff  如果审查通过,制定arc land –onto=分支名合并代码并提交,提交后开发分支将被删除

liuhaihua@liuhaihuadeMacBook-Pro JWordpress % arc landLanding current branch 'master'. TARGET  Landing onto "master", selected by following tracking branches upstream to the closest remote. REMOTE  Using remote "origin", selected by following tracking branches upstream to the closest remote.You have untracked files in this working copy.  Working copy: /Users/liuhaihua/IdeaProjects/JWordpress/  Untracked changes in working copy:  (To ignore these 1 change(s), add them to ".git/info/exclude".)    .arcconfig    Ignore these 1 untracked file(s) and continue? [y/N] y FETCH  Fetching "origin/master"...These 1 commit(s) will be landed:      - d5d296e 测试arc Enter a commit message.Landing revision 'D1: 测试arc Enter a commit message.'... BUILDS  Checking build status... PUSHING  Pushing changes to "origin/master".Counting objects: 133, done.Delta compression using up to 8 threads.Compressing objects: 100% (132/132), done.Writing objects: 100% (133/133), 15.43 KiB | 3.86 MiB/s, done.Total 133 (delta 114), reused 0 (delta 0)remote: Resolving deltas: 100% (114/114), completed with 2 local objects.remote: Powered by GITEE.COM [GNK-3.8]To https://gitee.com/jxuasea/JWordpress.git

流程

git checkout -b featurexxx — 创建一个新分支,并修改代码 git add . && git commit -m tt — 将该提交的都提交上去 arc diff [lastcommit]此命令会将 lastcommit 到最新的 commit 之间的改动的所有代码发送到phabricator 平台,并创建一个 revision;如果没有指定 lastcommit,则会使用 master 分支来作为 lastcommit 的起点。运行命令后会弹出一个编辑面板,在此面板中你需要指定 reviewers,即指定一个或多个给你 review code 的人 如果指定了多个reviewers,则其中任何一个 review 通过就可以,不用全部 review 通过 另外编辑面板中也有一个 test plan 选项,国外人一般每个项目都有测试,所以此项是必填的,如果没有测试,我们只需要随便设置一个字段即可,比如设置成 no 或 skip如果觉得指派reviewer的用法不太方便,可以执行arc diff –preview根据生成的diff页面进入配置,生成revision. 以上操作之后,系统会发送邮件通知 reviewers 去 review 你的代码,你也可以通过 arc list 来查看当前 review 的状态  如果 review 没有通过,你需要在原来的基础上修改,修改完并 commit 之后需要执行 arc diff [lastcommit] –update D(id) 继续 review  

目前100000+人已关注加入我们

       

       

转载地址:http://zxwmf.baihongyu.com/

你可能感兴趣的文章
Windows下MinGW编译ffmpeg库
查看>>
SDL在windows下使用 - 显示YUV
查看>>
三种方式YUV420转RGB24/BGR24,实测可用
查看>>
Windows下使用VS2015编译openssl库
查看>>
Win10+VS2015编译libcurl
查看>>
Windows下使用jsoncpp
查看>>
Ubuntu下测试使用Nginx+uWsgi+Django
查看>>
Windows下编译x264
查看>>
visual studio调试内存泄漏工具
查看>>
开源Faac实现PCM编码AAC
查看>>
Windows下wave API 音频采集
查看>>
借船过河:一个据说能看穿你的人性和欲望的心理测试
查看>>
AndroidStudio 导入三方库使用
查看>>
Ubuntu解决gcc编译报错/usr/bin/ld: cannot find -lstdc++
查看>>
解决Ubuntu14.04 - 16.10版本 cheese摄像头灯亮却黑屏问题
查看>>
解决Ubuntu 64bit下使用交叉编译链提示error while loading shared libraries: libz.so.1
查看>>
MFC程序添加console窗口+printf打印输出信息
查看>>
VS生成DLL文件供第三方调用
查看>>
Android Studio color和font设置
查看>>
android GLSurfaceView匹配屏幕宽度及视频宽高比设置view大小
查看>>