Take Your .NET Core Code Quality to the Next Level with this SonarQube Tutorial!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] welcome friends in this today video i will teach you how to analyze a dot net group project with a sonar cube okay so let's get started so first we need to make sure that that our sonar cube server is running on local and for that we make sure that localhost colon 9000 9000 is the default port on which the sonar cube server is running on any local machine on windows i press this so it means i have up and running the sonar cube okay to run a code analysis for the dart net core project we need to first have a dotted core project so let's create a dotnet core project and let's name it a nut co project press next and let's choose the latest version which is the 5.0 and let's create okay so the project is created so let's build it and run it for the first time to make sure that everything is properly set up okay the project is start running and it will default take the port of 44371 might be it is different for you but don't worry okay welcome so now we have set up the asp.net core project successfully okay now let's go to the sonarqube projects and create a new project as i am running the code from my local machine so i select the manually otherwise there are some other options available okay let's name the project same what we have named it in the vl studio and we have a net core project click setup your project key and the project display name should be unique if you are have more than one projects available in the sonar cube make sure that everything every project have a unique name and a project name key click on setup okay now i need to link the source code with this project i have source code available local machine so click local and in this generator token if i have make it unique so let's copy this name and paste here as a name as a token and it will generate a unique token for us for this project so this will be the unique token for this project click on continue okay here uh we need to click on dotnet and under the dotnet we have two options.net core and dartmouth framework so the first option is for us and here is a guide that make sure that the dotnet tool folder in your local path is set and also the dotnet tool is also installed into your system to check this that whether this dotnet tool is installed or not into your system we simply need to press the window icon and then the cmd and then right click on this node.js command and right click as an admin and simply type the dot net okay the dotnet is available and dotnet tool is also up and running and if you are not getting this result mean this result it mean dotnet tool is not installed so you need to simply copy this command and run it here just like this one so it will install the dotnet tool install dash dash global dotnet scanner sonar scanner once you hit the enter it will install the dotnet tool for the dotnet sonar scanner and it make it available for the globally so after that whenever we run it from the projector fold project directory this dotnet snort scanner cube sonar scanner command is available so let me hit run you see it uh the sdk version this one available i mean this is a dotted core sdk which i have installed in my system all this telemetry system and it give me a warning message that tool dotnet sonar scanner is already installed but if you don't have dotnet sonar scanner available into your system it will install it for you right okay so what's next so next we have three command we need to copy it one by one and need to run in the project directory we click the copy and let's go to the right click on this solution folder go to the projector file directory either from here either you can browse browse through the folder explorer so this is the project this is the folder of the project so okay this is the project for which i need to run this sonar scanner for the dot net code so let's simply type the cmd here are you can open the command line and change the directory and reach to your desired project location so let me expand it for the just real space and i have already copied this command from here copy it let paste me and hit enter okay snares cube build and scanning start because this command says dotner sonar scanner begin for this project for this key on this location right and the next command is dotnet build either you can simply type it or we can simply copy it paste and simply press the hat hit button or hit the enter button it's actually based on your project size and base on your project number of source file it will take time because this is a very simple and lightweight project and the template project so it will not taking too much time so build succeeded you will definitely got this message and before run before to run the command against the project uh in the command line you make sure that you have properly built the project into the va studio okay let's go to the last command which is the command which says the sonar scanner that okay generate the code quality and code coverage report for this project so hit enter you see all the file are starting analyzed by the sonar scanner and all individual file either is a c sharp file gs file type skip file or any other file in that solution or project it will actually analyze all these things and whenever you first time run it it will definitely show you a quality score or quality gate as a pass so don't uh be fooled by this statement because sonar's cube has something which is whenever you run the first time against any project it actually says that okay this is your first turn and i will like pass everything whatever you have done already but on the next consecutive run it actually show the original report okay so our analysis is complete and the report is available and report is available here on this project directory uh project location so let me go to this here and you see it automatically generate report for us okay and let's uh browse one by one through different things but this is the overall report it says we have four bug available in the project no vulnerabilities three security hotspot and the code that is one hour 15 minute 15 quart smells and overall and this is the individual uh issues which is listed one by one you can i just you can go to this code and flip through that okay what are the different things available in this and individual file and folder and all this this is the maya in in under under that you can check different things like code coverage code reliability security maintainability and the duplication and the complexity of the code and project and all these things so uh this is something which is called the sonar cube code analysis for a dot net core project so here is the thing right so thank you very much for watching this video goodbye
Info
Channel: Easy Programming
Views: 36,846
Rating: undefined out of 5
Keywords: C#, Code Analysis, Code Quality, CodeBugs, Improve Code Quality, NET Core, Quality Gate, SonarQube, SonarScanner, SonarScanner C#, code coverage, configure sonarqube, how to install sonarqube, identify code quality issues, net core sonarqube, sonarqube installation, sonarqube installation on windows, sonarqube integration with jenkins, sonarqube net core, sonarqube tutorial, sonarqube tutorial for beginners, sonarqube tutorials, static code analysis, what is sonarqube
Id: Mhj36wE2CtU
Channel Id: undefined
Length: 10min 42sec (642 seconds)
Published: Sat Nov 06 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.