Number of Types in a Package

Count the number of types that occur in compilation units that declare themselves to be part of a package. This includes nested types, local classes and anonymous classes in such compilation units.

Pre-packaged Query

Name of query = "Semmle/Metrics/Packages/Size/Packages that contain many types"

Reports packages that have source files in them, and which contain more than 20 types, in decreasing order of the number of types, as a bar chart. This bound is on the low side compared to that of CodePro, which recommends 30.

from MetricPackage p, int ts
where p.fromSource() and ts = p.getNumberOfTypes() and ts > 20
select p,ts order by ts desc

.QL Source of Metric

This metric is defined in MetricPackage. Its definition reads:

    int getNumberOfTypes() {
      result = count(RefType t | t.getPackage()=this)
    }

References

Instantiations . CodePro Metrics - Details - Basic 2007.

Digg!Reddit!Del.icio.us!Facebook!Slashdot!Technorati!StumbleUpon!Ma.gnolia!

Comments
Only registered users can write comments!
 
< Prev   Next >