Quality Profiles are getting changed automatically with each run of sonar analysis

Template for a good bug report, formatted with Markdown:

  • versions used (SonarQube : * Community Edition
    Version 7.7 (build 23042)
    LGPL v3
    Community
  • error observed : quality profile for one project in sonarqube getting changed for each analysis. when we check in quality profiles it show the project is assigned to that particular profile but when we go in project overview it shows different profile which is default sonar_way.
    Also from activity logs we come to know that the sonar profiles changed from this to this.
    PFB are the sonar analysis steps added in project:

required metadata

sonar.projectKey=virginmedia-smp54
sonar.projectName=PS_VIRGINMEDIA_SMP_5.4
sonar.projectVersion=1.0
sonar.scm.disabled=true
sonar.profile=PS-SMP-Legacy

path to source directories (required)

sonar.sources=$WORKSPACE/virginmedia-src
sonar.java.binaries=$WORKSPACE
sonar.exclusions=/*.json,/.js,**/.d.ts,/*.html./.xml, /build//,/webapp//*

  • steps to reproduce : run the sonar analysis.
  • potential workaround : checked the logs for build output. in logs it is showing as used profiles. the profiles are changing for each run even we have set the appropriate profile to project.

P.S.: use the #bug:fault sub-category if you’re hitting a specific crash/error , or the #bug:fp sub-category for rules-related behaviour

Can anyone please help me on this …?
quick replies are really appreciated…

Hi,

Sorry this fell through the cracks.

In fact, the sonar.profile has been removed in recent versions partly because of exactly what you’re experiencing. When you specify sonar.profile in your analysis, you override the profile that would normally be used. It is expected that you still see the other profile in the UI. Analysis parameters provide a temporary override; they do not re-assign.

 
HTH,
Ann

Hi Ann,
As you suggested we have removed the sonar.profile from our analysis code.
but still the profile got changed after execution of sonar analysis.

so even after we are not overriding the profile why it is getting changed ? we have not done any kind of change in source code before execution and after execution as well.

please suggest.

Hi,

How about a screenshot of where you’re seeing this change?

 
Ann

i am seeing the change here on project dashboard.

as in below sniipet you can see the PS-SMP-Legacy has been applied for this project.

As in activity you can see the changes happened for each execution or the suggestion it is giving us to use.

1 Like

Hi,

Thanks for the thorough pictorial documentation.

I admit that I’m stumped at the moment. I’m not sure how useful this will be, but could you check your analysis logs? If possible I’d like to see everything from the analysis command itself through to the line(s) listing the profiles that will be used.

 
Thx,
Ann

can you tell me where do i find the analysis logs…?

Hi,

The analysis logs are going to be… in Jenkins? Or wherever it is you’re running analysis from.

 
Ann

required metadata

sonar.projectKey=virginmedia-smp54
sonar.projectName=PS_VIRGINMEDIA_SMP_5.4
sonar.projectVersion=1.0
sonar.scm.disabled=true
#sonar.profile=PS-SMP-Legacy

path to source directories (required)

sonar.sources=$WORKSPACE/virginmedia-src
sonar.java.binaries=$WORKSPACE
sonar.exclusions=/*.json,/.js,**/.d.ts,/*.html./.xml, /build//,/webapp//*

The above are the analysis commands for my project where i have commented out the quality profile which i am passing thorugh my code. bbut still i am facing the quality profile change issue.

Hi Ann,
did you get a chance to look into this issue?

Hi,

My question/request remains the same:

 
Ann

Hi again,

My colleague has pointed out SONAR-11878 to me, which sounds like your problem (altho without analysis logs it’s only a guess). Since that ticket is fixed in 7.8 your best bet is to upgrade to at least 7.9.2 - the current LTS - if not 8.1, the current version.

 
Ann

Thanks Ann,
i am working on upgrade of sonarqube to 8.1 LTS.
but could you please let me know why the issue is happening for only single project, not for the rest all.

Hi,

The problem can happen intermittently with large projects. So I guess you only have one that crosses the threshold to “large”.

 
HTH,
Ann

Hi Ann,
i have upgraded the version to 8.1 LTS and its working perfectly fine for the project which was facing issue previously. he cause was only the line of code it is having.

thank you for your response…!!