You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Tom Copeland <to...@infoether.com> on 2002/11/07 17:49:14 UTC
Unused imports compose only about 1% of the Jakarta source code....
...which is pretty good. 563K LOC, 5300 unused imports. Here are the
details:
===========================================================
Module name Lines of code Unused imports
----------- ------------- --------------
jakarta-ant 46879 46
jakarta-avalon 1885 2
jakarta-bcel 16251 30
jakarta-cactus 3166 1
jakarta-commons 90015 562
jakarta-commons-sandbox 99216 1291
jakarta-ecs 17285 84
jakarta-ecs2 1414 12
jakarta-james 11492 76
jakarta-jetspeed 32321 626
jakarta-jmeter 23352 108
jakarta-log4j 11968 46
jakarta-lucene 5369 46
jakarta-ojb 29835 165
jakarta-oro 5919 3
jakarta-poi 21821 66
jakarta-regexp 1811 2
jakarta-struts 15573 184
jakarta-taglibs 37740 418
jakarta-tomcat-4.0 39514 890
jakarta-turbine-fulcrum 9244 139
jakarta-turbine-jcs 8303 88
jakarta-turbine-jyve 4304 99
jakarta-turbine-maven 3078 13
jakarta-turbine-torque 8360 1
jakarta-velocity 15620 322
jakarta-velocity-dvs l914 21
===========================================================
Fun, huh? This report took about 23 minutes to run, and was generated
by PMD, JavaNCSS, Ruby, and the letter 'A'. Here's the Ruby script:
=======================================
#!/usr/local/bin/ruby
class AllModules
attr_reader :mods
def initialize
@mods = []
@mods << Mod.new("jakarta-ant", "src/main")
@mods << Mod.new("jakarta-avalon", "src/java")
@mods << Mod.new("jakarta-bcel", "src/java")
@mods << Mod.new("jakarta-cactus", "framework/src/java")
@mods << Mod.new("jakarta-commons", "")
@mods << Mod.new("jakarta-commons-sandbox", "")
@mods << Mod.new("jakarta-ecs", "src/java")
@mods << Mod.new("jakarta-ecs2", "src")
@mods << Mod.new("jakarta-james", "src/java")
@mods << Mod.new("jakarta-jetspeed", "src/java")
@mods << Mod.new("jakarta-jmeter", "src")
@mods << Mod.new("jakarta-log4j", "src/java")
@mods << Mod.new("jakarta-lucene", "src/java")
@mods << Mod.new("jakarta-ojb", "src/java")
@mods << Mod.new("jakarta-oro", "src/java")
@mods << Mod.new("jakarta-poi", "src/java")
@mods << Mod.new("jakarta-regexp", "src/java")
@mods << Mod.new("jakarta-struts", "src/share")
@mods << Mod.new("jakarta-taglibs", "")
@mods << Mod.new("jakarta-tomcat-4.0",
"catalina/src/share")
@mods << Mod.new("jakarta-turbine-fulcrum", "src/java")
@mods << Mod.new("jakarta-turbine-jcs", "src/java")
@mods << Mod.new("jakarta-turbine-jyve", "src/java")
@mods << Mod.new("jakarta-turbine-maven", "src/java")
@mods << Mod.new("jakarta-turbine-torque", "src/java")
@mods << Mod.new("jakarta-velocity", "src/java")
@mods << Mod.new("jakarta-velocity-dvsl", "src/java")
end
end
class Mod
attr_reader :modulename, :srcdir
attr_accessor :ncss, :unusedimports
def initialize(modulename, srcdir)
@modulename = modulename
@srcdir = "#{modulename}/#{srcdir}"
end
def to_s
return "#{modulename}, #{srcdir}"
end
end
if __FILE__ == $0
jakartaroot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
mods = AllModules.new.mods
mods.each do |mod|
puts "Working on #{mod.modulename}"
puts "Checking it out"
`cvs -Q -d#{jakartaroot} co #{mod.modulename}`
puts "Running JavaNCSS"
`find #{mod.srcdir} -name "*.java" > files.txt`
mod.ncss = `/usr/local/javancss/bin/javancss -ncss
@files.txt`.split(" ")[2]
puts "Running PMD"
mod.unusedimports = `java -jar /home/build/pmd.jar
#{mod.srcdir} text rulesets/imports.xml | wc -l`.gsub(/ /, '')
puts "Cleaning up"
`rm -rf #{mod.modulename}`
end
puts "-------------------------------------------------"
puts "Module name Lines of code Unused imports"
mods.each do |mod|
puts
"#{mod.modulename.ljust(20)}#{mod.ncss.to_s.ljust(15)}#{mod.unusedimport
s.to_s.ljust(5)}"
end
end
=======================================
Tom Copeland
InfoEther
703-486-4543
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Unused imports compose only about 1% of the Jakarta source code....
Posted by "Vladimir R. Bossicard" <vl...@bossicard.com>.
> ...which is pretty good. 563K LOC, 5300 unused imports. Here are the
> details:
Since every other tool (Eclipse, IntelliJ) can fix this automatically
(and within minutes) I think that the 0,01% an be easily achievable.
Since some people use this metric to judge the quality of a code (you
can argue if it makes sense or not) it's time to invest some time to
automatically fix this!
-Vladimir
--
Vladimir R. Bossicard
www.bossicard.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Unused imports compose only about 1% of the Jakarta source code....
Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Tom Copeland" <to...@infoether.com> writes:
> Fun, huh? This report took about 23 minutes to run, and was generated
> by PMD, JavaNCSS, Ruby, and the letter 'A'. Here's the Ruby script:
"Hi boys and girls! Today's episode was brought to you by the letter
A." ;-)
--
Daniel Rall <dl...@finemaltcoding.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: More fun with unused/duplicate/unnecessary import statements
Posted by Tom Copeland <to...@infoether.com>.
Done (note that the link changed slightly):
http://cvs.apache.org/~tcopeland/jakarta_bad_imports.htm
Whew, 888K lines of code. Crikey.
See ya,
Tom
> -----Original Message-----
> From: Vadim Gritsenko [mailto:vadim.gritsenko@verizon.net]
> Sent: Thursday, November 21, 2002 9:36 AM
> To: Jakarta General List
> Subject: Re: More fun with unused/duplicate/unnecessary
> import statements
>
>
> Tom Copeland wrote:
>
> >Done:
> >
> >http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
> >
> >
>
> How about adding xml-* projects into the list?
>
> Vadim
>
>
>
> >Tom
> >
> >
> >
> >>-----Original Message-----
> >>From: Lavandowska [mailto:flanandowska@yahoo.com]
> >>Sent: Wednesday, November 20, 2002 3:26 PM
> >>To: Jakarta General List
> >>Subject: Re: More fun with unused/duplicate/unnecessary
> >>import statements
> >>
> >>
> >>This is really neat, could you add a "percentage" column
> though, just
> >>to save me from trying to do the math in my head?
> >>
> >>Thanks.
> >>
> >>--- Tom Copeland <to...@infoether.com> wrote:
> >>
> >>
> >>
> >>>i.e., imports from the same package. Numbers are about
> the same....
> >>>
> >>>http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
> >>>
> >>>
>
>
>
> --
> To unsubscribe, e-mail:
> <mailto:general-> unsubscribe@jakarta.apache.org>
> For
> additional commands,
> e-mail: <ma...@jakarta.apache.org>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: More fun with unused/duplicate/unnecessary import statements
Posted by Vadim Gritsenko <va...@verizon.net>.
Tom Copeland wrote:
>Done:
>
>http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
>
>
How about adding xml-* projects into the list?
Vadim
>Tom
>
>
>
>>-----Original Message-----
>>From: Lavandowska [mailto:flanandowska@yahoo.com]
>>Sent: Wednesday, November 20, 2002 3:26 PM
>>To: Jakarta General List
>>Subject: Re: More fun with unused/duplicate/unnecessary
>>import statements
>>
>>
>>This is really neat, could you add a "percentage" column though, just
>>to save me from trying to do the math in my head?
>>
>>Thanks.
>>
>>--- Tom Copeland <to...@infoether.com> wrote:
>>
>>
>>
>>>i.e., imports from the same package. Numbers are about the same....
>>>
>>>http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
>>>
>>>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: More fun with unused/duplicate/unnecessary import statements
Posted by Lavandowska <fl...@yahoo.com>.
Fantastic! Thanks!
--- Tom Copeland <to...@infoether.com> wrote:
> Done:
>
> http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
>
> Tom
>
> > -----Original Message-----
> > From: Lavandowska [mailto:flanandowska@yahoo.com]
> > This is really neat, could you add a "percentage" column though,
> just
> > to save me from trying to do the math in my head?
> >
> > Thanks.
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: More fun with unused/duplicate/unnecessary import statements
Posted by Tom Copeland <to...@infoether.com>.
Done:
http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
Tom
> -----Original Message-----
> From: Lavandowska [mailto:flanandowska@yahoo.com]
> Sent: Wednesday, November 20, 2002 3:26 PM
> To: Jakarta General List
> Subject: Re: More fun with unused/duplicate/unnecessary
> import statements
>
>
> This is really neat, could you add a "percentage" column though, just
> to save me from trying to do the math in my head?
>
> Thanks.
>
> --- Tom Copeland <to...@infoether.com> wrote:
>
> > i.e., imports from the same package. Numbers are about the same....
> >
> > http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Web Hosting - Let the expert host your site
> http://webhosting.yahoo.com
>
> --
> To unsubscribe, e-mail:
> <mailto:general-> unsubscribe@jakarta.apache.org>
> For
> additional commands,
> e-mail: <ma...@jakarta.apache.org>
>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: More fun with unused/duplicate/unnecessary import statements
Posted by Lavandowska <fl...@yahoo.com>.
This is really neat, could you add a "percentage" column though, just
to save me from trying to do the math in my head?
Thanks.
--- Tom Copeland <to...@infoether.com> wrote:
> i.e., imports from the same package. Numbers are about the same....
>
> http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
More fun with unused/duplicate/unnecessary import statements
Posted by Tom Copeland <to...@infoether.com>.
Here's the same sort of report that I posted a couple weeks ago, but
this time it includes stuff like:
============
package foo.bar;
import foo.bar.Baz;
public class Buz {}
============
i.e., imports from the same package. Numbers are about the same....
http://cvs.apache.org/~tcopeland/bad_imports_20_nov_02.htm
Yours,
Tom
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>