GSoC 2015 Updates

As part of my GSoC this summer, I was making a DBus api for coala. Recently, we completed the basic api which is fairly usable 🙂

The coala DBus API essentially creates a server which can have multiple clients connected to it. The clients communicate to the coala server using DBus. To start the server, first install coala and then simple run coala-dbus.

This spawns a bus with the name org.coala.v1 as a SessionBus and can be verified and tested using a DBus debugger like DFeet. The bus has 1 object-path by default – /org/coala/v1. This is the first point of contact with coala for any client.

The object-path /org/coala/v1 has the interface org.coala.v1 which contains the two methods – CreateDocument and DisposeDocument. These are used to tell coala about the documents you wish to analyze.

The CreateDocument method has 1 string argument – the path of the document. A document is defined by it’s path. The path should be a absolute path, not a relative one. This method returns an object-path which will be hence forth used to interact with that document. The DisposeDocument method also has 1 string argument, and disposes the object-path corresponding to that path.

Now, the object-path returned by the CreateDocument method also has the interface org.coala.v1. This interface is used to handle which config file coala will use to analyze the document, and the function to get analysis results. It contains 4 functions:

  • GetConfigFileArgs: none. Returns: the config file path
  • SetConfigFileArgs: the config file path. Returns: the config path which is set after it executes.
  • FindConfigFileArgs: the config file path. Returns: the config path which is set after it executes.It attempts to find the config file related to the file by searching in parent directories till it finds a `.coafile`.
  • AnalyzeArgs: none. Returns: an array of DBus structures.
    The structure contains:

    • The name of the section
    • Boolean which is true if all bears in the section executed successfully
    • List of results where each result is a list which contains:(str)origin, (str)message, (str)file, (str)line_nr, (str)severity

Although this is a useful and simple API – there are some small issues with it which still need to incorporated. First off the error reporting isn’t up to par, there is no method of logging messages like warnings and information currently. Also, the settings can currently only be changed by using a coafile – and the DBus api itself cannot change it. We’ll be working on this and improving it soon 🙂

Advertisements

2 Comments Add yours

  1. Hi! What’s the rationale behind using “org.coala” as the namespace? The coala.org domain doesn’t seem to have anything to do with coala-the-code-analyzer.

    Like

    1. abdealijk says:

      Thanks for bringing this to my notice!

      I’ve raised a bug and this will be solved soon. https://github.com/coala-analyzer/coala/issues/822

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s