The component viewer is the heart of SonarQube: it displays the source code of a file (both source and test files), and all relevant information about it:


You will land on the component viewer:

General overview


The component viewer is composed of 3 parts:


The header can contain up to 5 tabs, one per main axis: Overall Measures, Technical Debt and Issues, Coverage (for source files) or Tests (for test files), Duplications, and SCM. Tabs which aren't relevant to the current file won't be shown. For instance, if the project has no tests, the coverage tab will be omitted. Similarly, the duplications tab will be omitted if there are no duplications, and the SCM tab will be missing if the relevant plugin is not installed.

You can click on each tab to show its detailed metrics in a row below the tabs. Click the same tab again to toggle display of the metrics row.

Each tab consists of two parts: a thin blue line at the top, which controls decoration, and the tab itself, which controls filtering.

Clicking on a tab does not have any impact on the source code that is displayed. It just shows detailed information about the code. You have to explicitly click on a filter or on a decoration bar to change something on the source code.


On top of each tab (except the first one), a light blue bar can be toggled to activate decoration of the source code with information relevant to the tab. 


When a tab is expanded, it gives access to filtering actions:


This means that if you activated the "Unresolved issues" filter in the Issues tab and you expand the Coverage tab, nothing will change in the source code until you select one of the filters of the Coverage tab.


Decoration and filtering work independently of each other. For instance, it's possible to filter the source code to see only the parts where there are info issues, while keeping the coverage information displayed on those lines - like in the example below:

If you click on one of the filters available on the Issue, Coverage, or Duplication tabs, the component viewer automatically toggles the appropriate decoration for you if it's not already active.

The Workspace

The workspace keeps track of your navigation history when you use the features of the component viewer itself to navigate between files. It can help you:

It is populated as soon as you initiate navigation using either Duplicationed blocks, or Coverage per tests

Note that the workspace is automatically cleaned up once you stop navigating through these 2 features.

The source code

The main purpose of the component viewer is to show source code:

This feature is available for Java code only for the moment, and limited to the scope of the file. It allows you to answer the questions:

  • Where is this variable or method declared? 
  • Where is it used?

Eventually, this feature should be available for other languages and for identifiers declared outside the current file.


To learn more about the decorating and filtering capabilities of each of the header tabs, please see