Number of Callables in a Package

Count the total number of callables (methods or constructors) defined anywhere in a compilation unit that declares itself to be part of the package.

The count includes all callables, including constructors and methods defined in nested classes, local classes and anonymous classes, and also the class initialization method clinit.

Pre-packaged Query

Query name = "Semmle/Metrics/Packages/Size/Packages that contain many callables"

Reports packages that have more than 200 callables, in decreasing order, as a bar chart.

from MetricPackage p, int cs
where p.fromSource() and cs = p.getNumberOfCallables() and cs > 200
select p,cs order by cs desc

.QL Source of Metric

This metric is defined in MetricPackage, and it reads as follows:

    int getNumberOfCallables() {
      result = count(Callable m | m.getDeclaringType().getPackage()=this)
    }

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

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