SemmleCode: free Eclipse plugin to query java code

  • 13 years ago
    SemmleCode is a new free Eclipse plugin to improve software quality. With this tool, it is possible now to find bugs, compute metrics, enforce coding conventions by writing little simple code queries.

    For example, to find all packages that are larger in size than a certain limit, you could write the following query:

    from MetricPackage p, int loc
    where p.fromSource() and loc = p.getNumberOfLines() and loc > 1000
    select p,loc order by loc desc

    getNumberOfLines() method is not a fixed function. It is defined in the MetricPackage type, and you can easily redefine it:

        int getNumberOfLines() {
    result = sum(CompilationUnit cu |
    cu.getPackage()=this |

    You can visualise the results of this query as bar-charts, pie-charts or using many other visualisation modes. SemmleCode supports eight different views, such as tree-view, table-view, Eclipse's problems view, graph view, etc.

    The key difference of this tool is the fact that all its predefined checks for bugs and metrics rules are just simple, intuitive object-oriented queries of a few lines. This makes them easily adaptable to your specific project. Defining new code queries becomes also an easy task.

    It is of course also possible to use SemmleCode just as a general semantic search tool. Writing queries to identify all elements with certain properties can be done just as easily as shown above.

    Try it out for yourself. You can download SemmleCode at There is also a SemmleCode Community page (, where you can share your queries or request new features. Enjoy!



    Semmle Limited

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”