nikcio opened a new pull request, #709: URL: https://github.com/apache/lucenenet/pull/709
This adds a sonar cloud workflow for scanning the project when there's pushes or PR's to the master branch. ## Prerequisites - [ ] SonarCloud account with permission to use the Lucenenet repository - [ ] SONAR_TOKEN in GitHub secrets for actions ### SonarCloud account with permission to use the Lucenenet repository You can add a project to SonarCloud by registering a user at: https://www.sonarsource.com/products/sonarcloud/ <img width="949" alt="image" src="https://user-images.githubusercontent.com/24605285/196895340-423b4f8b-3b63-4501-a8d2-2d8f4b1b04d3.png"> <img width="959" alt="image" src="https://user-images.githubusercontent.com/24605285/196895493-27c35999-3a2c-4aeb-af53-93be5f6c919a.png"> Then you need give SonarCloud access to use the Lucenenet repository. I don't have any screenshots of that but the guide should lead you straight trough it. Then You just need to analyze the project: <img width="959" alt="image" src="https://user-images.githubusercontent.com/24605285/196895773-3e58727b-e563-4e62-a429-e61376d7caa8.png"> ### SONAR_TOKEN in GitHub secrets for actions When prompted with setting up an automated workflow then just press on the "GitHub actions" option and create the Github secret `SONAR_TOKEN` with the value presented. You don't have to create a workflow like presented that's what is in this PR. ## Setting up the project Quality gate Sonar has the concept of Quality gates this is a description of what a good PR includes and therefore what criteria marks a PR as passing. Because the Workflow in the current state doesn't run any tests we need to disable this parameter so it don't mark everything as not parsing. Go to your organization (This should be apache I think) <img width="956" alt="image" src="https://user-images.githubusercontent.com/24605285/196897822-a808a8a7-b5c7-40d5-aea7-d2f33466e6de.png"> Then to Quality gates <img width="958" alt="image" src="https://user-images.githubusercontent.com/24605285/196898111-fc4722d1-66b0-46ad-b04a-06c1762ef283.png"> Just copy the "Sonar way" and name it. Mine is called "Sonar way (no tests)" <img width="958" alt="image" src="https://user-images.githubusercontent.com/24605285/196898326-6a3b04b1-021c-4360-8c01-575d93aefaad.png"> Then just delete the coverage requirement <img width="738" alt="image" src="https://user-images.githubusercontent.com/24605285/196898612-a1db85cf-7aa7-4967-a59a-2f97d0929e1b.png"> Navigate to the lucenenet project and select the quality gate by hovering "Administration" <img width="959" alt="image" src="https://user-images.githubusercontent.com/24605285/196899067-7bd5223a-b6d1-452a-a113-d3cb4422176c.png"> <img width="754" alt="image" src="https://user-images.githubusercontent.com/24605285/196899137-872a42fa-6051-454f-ab89-c5845b5802a7.png"> ## Setting up the project Quality profiles Then there's the concept of Quality profiles. This is what decides what rules there's active for the project. Same as "Quality gate" navigate to the organization view and press "Quality profiles" this time. <img width="959" alt="image" src="https://user-images.githubusercontent.com/24605285/196899529-9de4909e-01e1-4bd1-bdff-9a73eb1732fa.png"> Then scroll down to C# and copy the "Sonar way" <img width="801" alt="image" src="https://user-images.githubusercontent.com/24605285/196899699-ef419584-1b5f-4562-b8c5-cff523c30ac2.png"> Then after it's copied disable the following rules as of decided in #648 <img width="960" alt="image" src="https://user-images.githubusercontent.com/24605285/196900080-5e98ebbc-c88c-4d8c-b81a-ea0333ff96d2.png"> <img width="960" alt="image" src="https://user-images.githubusercontent.com/24605285/196900148-7999a636-e222-4ae9-ab23-f5ca17634211.png"> <img width="958" alt="image" src="https://user-images.githubusercontent.com/24605285/196900224-9196db65-55db-402f-9593-ea842a009891.png"> Then we need to add the "Quality profile". Navigate back to the project and press the "Quality profile" this time. <img width="956" alt="image" src="https://user-images.githubusercontent.com/24605285/196900554-c8b5d5d1-d40a-4166-a025-7849de02d20e.png"> And set the custom profile here: <img width="957" alt="image" src="https://user-images.githubusercontent.com/24605285/196900717-454d35f6-df01-4f82-819e-b05bc5df802c.png"> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@lucenenet.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org