CodeReview of JDK Source Code

jdk1.6.0_35/src.zip, only java package is reviewd(full package review caused a OutofMemory on java heap size).

Checkstyle Review

tyRules.xml:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">

Run code review

java -jar checkstyle-5.6-all.jar -c tyRules.xml -r /home/chad/tmp/jdksrc -o result.txt

Get Review Result

grep "Method length is" result.txt|wc -l

grep "Nested if-else depth is" result.txt|wc -l

grep "More than 6 parameters" result.txt|wc -l

grep "max allowed is 1,000" result.txt|wc -l

grep "Found duplicate of" result.txt|wc -l

grep "Cyclomatic Complexity is" result.txt|wc -l

Sonar Review

sonar-project.properties:

sonar.projectKey=jdk.sonar.analysis sonar.projectName=JDK sonar.projectVersion=1.6 sonar.sources=jdksrc sonar.login=liuyan sonar.password=liuyan sonar.language=java sonar.profile=TongYong sonar.skipDesign=true sonar.dynamicAnalysis=false

Run code review

/opt/sonar-server/runner/sonar-runner-2.2/bin/sonar-runner

The profile TongYong is imported from above tyRules.xml.

Result

From Sonar

Lines of code: 202,505 (NBNC, not blank not comment code lines);

559,577 lines (total lines = NBNC + blank + comment);

Above can be verified by cloc.

2172 Classes, 21,275 methods, 675 method cyclomatic complexity are greater than 10,

Cyclomatic Complxity

GCP: 298/6276 = 4.75%

JDK: 674/21275 = 3.17%

Duplicate Lines

GCP:

JDK: 825/

posted on 2014-03-18 08:04  leechau  阅读(245)  评论(0编辑  收藏  举报

导航