Hammurapi (code review platform)详细介绍 之一


Hammurapi*, king of Babylon (1792-1750 BC)

Hammurapi (1792-1750 BC) was the sixth ruler of a line of Amorite kings, who hadestablished themselves at the city of Babylon around 1900 BC.Hammurapi is perhaps most celebrated for his so-called law-code. Although it was notintended to function like a modern law-code, its statement of traditional or contemporarypractice in all areas of civil and criminal law was an assertion of Hammurapi’s role as thechampion of justice. One copy of the text, written in Akkadian cuneiform on a large stela,was carried off as booty by an Elamite army to the city of Susa in the thirteenth centuryBC, and is now in the Musée du Louvre, Paris. There are 282 laws.English translation of the Hammurapi Code of Laws can be found here:http://www.bible-history.com/babylonia/BabyloniaCode_of_Hammurapi.htmOur Hammurapi is a code review tool – it scans Java source files and finds “smelly places”.We don’t have as many laws (they are called inspectors) as on the Hammurapi stela.Currently there are over 120 built-in inspectors shipped with Hammurapi. Custom inspectors are easy to write.

Hammurapi contains the following tools:

•Hammurapi – performs automated reviews of Java source code. Can be executed fromcommand line or as Ant task. Loads all source files in database-backed Jsel repository andgenerates detailed reports. Intended audience – architects who want to see the whole picture.

•Quickurapi (quick Hammurapi) – Sacrifices insight for the sake of speed. Reviews Java filesone-by-one using in-memory Jsel repository. Generates simplified reports. Can be executedfrom command line or as Ant task. Intended audience – developers who care aboutcompliance of their files.

•Archiver – packages source files and class files/jars in an archive file (.har) to be processedby Hammurapi or Quickurapi. This tool allows to separate review request and execution inspace and time. Possible usage scenarios: a) Troubleshooting b) Archiver can be executed aspart of build process (it is very fast) and put an archive into a queue directory or ftp it toanother machine to be processed by Hammurapi.•Query tool – Console application. Allows to query source repositories in a way similar toquerying databases. Uses OGNL for model navigation. There are plans to switch to OCL.Syntax: select <OGNL expression> from <type> where <OGNL expression>.

•Plugin framework – Classes to embed Hammurapi into Java apps.

•Eclipse plugin – Hammurapi plugin for Eclipse

 

TCO reduction:

– Developers learn while they work– Outsourcing and on-boarding is easier because corporate standard areenforced automaticallyInformation week: “Many companies are not satisfied with outsourcing”.One of reasons – low code quality.– Maintenance is easier because all code follows standards– Safety net provided by Hammurapi allows to use advanced codingtechniques, e.g. complex patterns.

Risk mitigation

Automated detection of potential problems mitigates risk of runtime failures Technology stack inspector mitigates risk of rework caused by usage ofimproper library or version of library

“Gartner says only 32% of the 2.5 million Java developers in the world have genuine
knowledge, which means there is a serious lack of high-level development skills.”

Review sample files:

• Download Hammurapi from http://www.hammurapi.org

• Unzip

• Run ant in projects/template directory

• Open project/template/review/report.html in a Web browser

Review your files:

• Create a copy of projects/template directory

• Put your source files to src directory

• Put jar files to lib directory

• Run ant clean

• Run ant

• Browse report created in review directory

Automated code inspection is just one of cogwheels in the  quality engine.You need to make sure that all wheels are greased and mesh properly。

www.r66r.net

www.r66r.net

• Inspectors and waivers can be loaded
from files and URLs, e.g. from a central
web server.
• Hierarchical inspector sets and
inspector configuration from multiple
sources – you can define common rules
and then fine tune them for technology,
component or review type.
• Waivers – handle special cases.
• Listeners – integration.
• HTML Reports – publish in Intranet.
• Builds can be failed on low code quality.
• Omnipresence:
Developer desktop – Eclipse plugin or
Quick task
Version control – CVS check-in handler
(Quick task)
Build process – Ant task.

Review results are persisted and reviews have
“time dimension”:
• Files changed since last review are marked with “New” icon
• Baselined reviews show deltas between current review and
base review
• History annotation shows codebase evolution in a table and
charts.
• Comply-on-touch policy
• Only modified files are reviewed – faster incremental
reviews while producing complete report.

www.r66r.net

www.r66r.net

www.r66r.net

www.r66r.net

www.r66r.net

www.r66r.net

Hammurapi inspectors work on Java metamodel in  contrast with most code review tools which work on AST (parse tree) or bytecode. It makes inspectors easy to write.
Jsel comparing to AST is like Java comparing to assembly language.

www.r66r.net

www.r66r.net

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值