sinceLeakPeriod parameter in api/issues/search

428 views
Skip to first unread message

Michael Rüegg

unread,
May 26, 2016, 7:58:40 AM5/26/16
to SonarQube, Michael Rüegg
Hi,

I tried to set the sinceLeakPeriod parameter of api/issues/search to “true” when also passing multiple componentKeys. Unfortunately, the service does not allow that and reports

{"errors":[{"msg":"One and only one component must be provided when searching since leak period"}]}

Do you know the reasoning for this? I mean e.g. when using the parameter “createdAfter” of this resource, passing multiple componentKeys is allowed.

I could of course set createdAfter to the leak period date, but I would first have to get the date of the leak period with the statistics resource which is somewhat inconvenient.

Thanks in advance,
Michael

nicolas...@sonarsource.com

unread,
May 26, 2016, 8:42:42 AM5/26/16
to SonarQube, rueegg....@gmail.com
Hi Michael,

Part of the reasoning is this: the Leak Period is a project-specific setting, meaning it can be different from one project to another. Take this scenario: project foo has a leak period 'since 3 months' and project bar has 'since previous version', using api/issues/search with sinceLeakPeriod=true and with multiple component keys (for foo and bar) would essentially let you mix completely different timeboxes into the same bag and could prove confusing.

Now there's one case where that same reasoning can definitely be challenged: components that have a parent-child relationship (e.g. files, modules, projects) as those therefore share the same Leak Period. SONAR-7578 is fixed in SonarQube 5.6 for this specific case.

Nicolas

Michael Rüegg

unread,
May 26, 2016, 10:19:59 AM5/26/16
to nicolas...@sonarsource.com, SonarQube
Hi Nicolas,

Thanks for your feedback. That makes indeed sense. Although, as you mentioned, this shouldn’t be an issue if all the components are from the same project.

I will now use api/issues/search with

sinceLeakPeriod=true
componentKeys=SONAR_PROJECT_KEY

which works perfectly with SonarQube 5.6. But what is the behaviour in older SonarQube versions?

By the way, I guess sinceLeakPeriod is not available for SonarQube versions older than 5.X where leak period was introduced, am I right? Maybe this should be documented in the API description on nemo.


Best regards,
Michael
Reply all
Reply to author
Forward
0 new messages