Measures, at your Service!

by g. ann campbell|

    If there's a set of data you regularly look up in SonarQube, the Measures Service - and saved filters - are going to be your new favorite SonarQube features.



    A user at my day job recently showed me a spreadsheet he's using to track the metrics of the "worst offender" files in his COBOL project. I was afraid I already knew the answer, but I asked how he was getting the data for each file. It was one time I wasn't happy to be right - he was doing it the hard way, manually recursing each branch of his project's components tree to find the numbers.

    That's when I pointed him to the Measures service. It lets you search for any type of resource based on a host of criteria. He was looking for files in his project that exceeded a certain threshold. This doctored screenshot shows the kind of search I showed him how to run:



    First he specified what he was looking for: files, and then the criteria by which to choose them: Components of the project, SonarQube in this case, with Coverage less than 90%. Just having the list of relevant files pulled neatly together thrilled him; I could tell by the way the corner of his mouth quirked up.

    Then it was a simple matter to edit the column set to show what he wanted to see:



    His mouth quirked again. He was really happy. Except...

    We both started to speak, but he beat me to the gate, "Can you save...?" I knew he didn't want to have to reconfigure this every time - who would?

    I had him close column editing mode (a crucial step), and the "Save As" link reappeared:



    He gave it a name, and knew that from then on, it would always be waiting for him in the saved filters menu:



    I got the mouth quirk again.

    Then, I showed him how to use a "Measure Filter as List" widget on his own private dashboard to display the saved filter automatically, and pointed out that he could make that dashboard the first page he saw in SonarQube.

    He actually smiled.