SonarSource / sonarlint-visualstudio

SonarLint extension for VisualStudio
https://redirect.sonarsource.com/doc/sonar-visualstudio.html
GNU Lesser General Public License v3.0
460 stars 77 forks source link

Visual studio doesn't show all the projects from the server #1022

Closed Prabhakarakolar closed 2 years ago

Prabhakarakolar commented 4 years ago

Description

Visual studio doesn't show all the projects from the server. if projects count is more than 1500.

Repro steps

  1. Create more than 1500 projects in sonarqube server.
  2. Install Sonarlint on Visual studio 2017/2019 try to connect with credentials (analyze --> Manage SonarQube connections).
  3. List doesn't show all the projects , it shows limited set.
  4. Try to search project which is not displayed in list.

Expected behavior

Using Search option it should be possible to find and bind any project.

Actual behavior

Visual studio is not showing all the projects.

Known workarounds

No

Related information

rita-gorokhod commented 4 years ago

@Prabhakarakolar I was not able to reproduce this issue. Please try upgrading your SonarLint extension and see if it still happens; there have been fixes around connected mode. If it still happens please reopen the issue.

appyit3 commented 4 years ago

I'm also getting this same issue. To reproduce, the number of projects in sonarqube have to be large. Like 5000 something. Then along with other git extensions, sonarqube is shown. But all the projects are not listed.

Prabhakarakolar commented 4 years ago

One work around for this issue is you can change your repository name to display at higher alphabetical order.

In my case I have Added prefix A to Repository name.

There was no change in the key.

Regards, Prabhakar

On Fri, Jul 24, 2020, 3:06 PM appyit3 notifications@github.com wrote:

I'm also getting this same issue. To reproduce, the number of projects in sonarqube have to be large. Then along with other git extensions, sonarqube is shown. But all the projects are not listed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SonarSource/sonarlint-visualstudio/issues/1022#issuecomment-663528539, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7VKNCUTTIO4MDC6YGZJFTR5GBL3ANCNFSM4I5EIHFQ .

rita-gorokhod commented 4 years ago

@Prabhakarakolar @appyit3 - Can you please check how many projects do you actually have? we have a limit of 10000, can you please confirm if you have more than that? (you can see how many you have in SonarQube/SonarCloud UI, when you go to the projects list). Btw, a workaround could be to bind to any project, and then manually edit the .slconfig file under your .sonarlint folder to the correct project's information and then re-bind.

Prabhakarakolar commented 4 years ago

Hello Rita,

We have approx 2000 projects.

Regards

On Fri, Jul 31, 2020, 12:16 PM Rita Gorokhod notifications@github.com wrote:

@Prabhakarakolar https://github.com/Prabhakarakolar @appyit3 https://github.com/appyit3 - Can you please check how many projects do you actually have? we have a limit of 10000, can you please confirm if you have more than that? (you can see how many you have in SonarQube/SonarCloud UI, when you go to the projects list).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/SonarSource/sonarlint-visualstudio/issues/1022#issuecomment-667048445, or unsubscribe https://github.com/notifications/unsubscribe-auth/AG7VKNB7QKCWD7Y3JCC4AW3R6KKZDANCNFSM4I5EIHFQ .

higorcoimbra commented 3 years ago

@rita-g-sonarsource can you explain what fields we have to edit from .slconfig file, please? And I couldn't find a "re-bind" function inside Visual Studio (currently using VS 2019). Thanks for the workaround!

rita-gorokhod commented 3 years ago

Hi @higorcoimbra. Open your .slconfig and you will need to change the following:

Save the file, re-open the solution in VS and go to the SonarQube page in Team Explorer. You might need to re-input the credentials. Let me know if it works for you.

higorcoimbra commented 3 years ago

@rita-g-sonarsource I followed the listed steps but when I try to acess the SonarQube page in Team Explorer, I'm getting the message "Bound project with key 'XXXXXXX' was not found on the connected server. Select a different SonarQube project, or use a different login that has access to the desired project.", although there is no difference on configuration between projects on the top of the list (those I can bind inside VS 2019) and the one I'm trying to bind, they all have the same permissions for me.

Things I've already check:

Other considerations:

Seems like even when I'm trying to bind using the .slconfig, the Extension is searching only on the 499th (first page) of the GET request on my Server URL. Can I do some workaround using query string or something to retrieve all of the projects?

rita-gorokhod commented 3 years ago

@higorcoimbra can you please execute the following API call against your SQ server? GET [SQ full ur]/api/components/search_projects?asc=true&p=1&ps=500 (along with the relevant basic authentication, see here).

You should be getting a response in the format of

{
"paging": {
"pageIndex": 1,
"pageSize": 500,
"total": <number of projects in your SQ server>
},
"organizations": [...],
"components": [...],
"facets": [...],
}

Couple of questions:

  1. What is your SQ version?
  2. When you run the query above, does the API return back the expected number of projects under "total" field?
  3. What happens when you re-run the web api call, this time when p parameter (page number) is 2, 3, etc? (e.g. api/components/search_projects?asc=true&p=2&ps=500). Do you get back the correct results?
  4. What is the HTTP status code of these responses? Is it 200 OK?
  5. If the API calls are successful, do you see the project that you're looking for in the responses? And if so, on which page is it? (first, middle, last?)
  6. If everything is successful, can you try to use the same token / username password in VS that you used for these calls?