The resource viewer currently enables to view the source code and the results of the unit tests
Viewing source code
There are currently 3 ways you can drill down to source code in Sonar:
- Through Measures drill down
- Through Violations drill down
- Through the classes clouds
Though the last one is slightly different in the way it appears (through tabs), the functionality is exactly the same in the three cases.
At the top, 4 tabs representing 4 different views on the code source.
In the middle, a contextualized header depending on the selected tab
At the bottom, the code source contextualized, depending on the chosen tab.
The Sources tab
This tab shows the source code as is, without any comment.
The code coverage tab
The code coverage tab shows the source code annotated with extra informations and colors showing the code coverage.
In the second column, next to each line of code (except empty lines and comments) appear the number of times the unit tests have "hit" the line. If it is 0, the line will be highlighted in red, otherwise the number of hit appears in green.
The Violations tab
The violations tab shows the source code annotated with extra informations and colors showing the coding rules violations.
In the second column, next to each line of code that violates at least one rule, the number of violation appears. Below the line will appear the reason of the violation, in red if the rule was mandatory, in yellow if the rule was optional.