DEV Community

Cover image for Getting started with NDepend Azure DevOps extensions
Bervianto Leo Pratama
Bervianto Leo Pratama

Posted on

Getting started with NDepend Azure DevOps extensions

Hello, everyone! I will share with you my experience with Code Quality NDepend for Azure DevOps. Please make sure you've set up/installed the extension to your Azure DevOps server.

  • After you installed the extension, you will need to set up the licenses. Please navigate to any of your Azure DevOps projects and click on the NDepend menu.

NDepend Menu

  • After you've set up the licenses, you need to set up the users.

users

  • You will need to set up the dashboard too. For me, I will choose all options.

options

NDepend Tasks

If you want to store the artifacts about the code quality scans, you will need to add NDepend Tasks. I will give you small job setups, so you will have the code quality results.

- job: "CodeQuality"
  pool:
    vmImage: "windows-2022"
  steps:
  - task: UseDotNet@2
    displayName: 'Use .NET Core SDK $(dotnetSdkVersion)'
    inputs:
      version: '$(dotnetSdkVersion)'
      includePreviewVersions: true
  - task: DotNetCoreCLI@2
    displayName: 'Restore project dependencies'
    inputs:
      command: 'restore'
      projects: '**/*.csproj'
  - task: DotNetCoreCLI@2
    displayName: 'Build the project - $(buildConfiguration)'
    inputs:
      command: 'build'
      arguments: '--no-restore --configuration $(buildConfiguration)'
      projects: '**/*.csproj'
  - task: DotNetCoreCLI@2
    displayName: 'Run unit tests - $(buildConfiguration)'
    inputs:
      command: 'test'
      arguments: '--no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/'
      publishTestResults: true
      projects: '**/*.Test.csproj'
  - task: NDependTask@1
    env:
      SYSTEM_ACCESSTOKEN: $(system.accesstoken)
Enter fullscreen mode Exit fullscreen mode
  • Important lines:

  • vmImage: "windows-2022". You will need this line, since currently NDependTask only supports windows OS.

  • You will need an environment for NDependTask. You will need the environment SYSTEM_ACCESSTOKEN so your NDependTask may upload your results to the build artifacts.

env:
  SYSTEM_ACCESSTOKEN: $(system.accesstoken)
Enter fullscreen mode Exit fullscreen mode
  • In summary, your jobs will be like this.

Task flows

Exploring the NDepend extensions

In your build results, you may see the result like this.

Build Results

You may get the summary of the NDepend tasks in the dashboard. I haven't set up the code coverage yet, that's why it's now shown up in my dashboard.

dashboard

You can navigate to the Issues/Debt tab for more details about the Issues.

Issues

One of my favorite features is Trend. I can see and track the changes of my % Debt.

Trend

Thank you

Thanks for reading. So, do you want to try it? You may use the trial versions if you want to try the extension. What are you waiting for? Grab it now and share your experiences. If you have more questions, you may comment here.

Thanks GIF

Top comments (0)