I am not able to see code snippets for issues reported in sonar cube. It is showing message as "if code is not visible Due to security settings, no source code can be displayed." Anyone know how to enable code view
-
If the project is private you need to have Browse or See Source code permission enabled for the user. – Pamela Sarkisyan Dec 31 '21 at 16:26
1 Answers
Instructions assume you have access to the "Administration" tab/page in Sonarqube, else you will need a friendly Sonarqube admin to enable this
Your Sonarqube instance > Administration > Projects > Management
Then search for the project you want to change this for. On the right hand side of the row for that project click the setting cog, and then select "Edit Permissions"
If the you don't have the "Edit Permissions", then they are probably missing "Administer" privilege for this project. So instead on the right hand side of the row for that project click the setting cog, and then select "Restore Access", this should give you the "Administer" privilege
Assuming you have found and clicked "Edit Permissions", you should be on the Permissions page and this should show a list of users and groups that Sonarqube recognises. Find the user(s) and or groups that are afflicted by this problem and then TICK "See Source Code" Now you should be done, retest to see if you can see the source code
Note at the top of permissions page you should also see 2 radio buttons [public and private], you could toggle from private to public, and this would be an alternative fix. BUT if you do this, consider that anyone who can login can probably see this project now!
Link to sonarqube documentation about "Security" and "Project Permissions" https://docs.sonarqube.org/latest/instance-administration/security/

- 123
- 1
- 5