PMDEvers.SonarCloud.NET 0.0.1-alpha0008

This is a prerelease version of PMDEvers.SonarCloud.NET.
dotnet add package PMDEvers.SonarCloud.NET --version 0.0.1-alpha0008                
NuGet\Install-Package PMDEvers.SonarCloud.NET -Version 0.0.1-alpha0008                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PMDEvers.SonarCloud.NET" Version="0.0.1-alpha0008" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PMDEvers.SonarCloud.NET --version 0.0.1-alpha0008                
#r "nuget: PMDEvers.SonarCloud.NET, 0.0.1-alpha0008"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install PMDEvers.SonarCloud.NET as a Cake Addin
#addin nuget:?package=PMDEvers.SonarCloud.NET&version=0.0.1-alpha0008&prerelease

// Install PMDEvers.SonarCloud.NET as a Cake Tool
#tool nuget:?package=PMDEvers.SonarCloud.NET&version=0.0.1-alpha0008&prerelease                

SonarCloud API Client for .NET Core

Github Release GitHub Actions Workflow Status GitHub License Github Issues Open Github Pull Request Open Scheduled Code Security Testing

This repository contains a .NET Core library for interacting with the SonarCloud API. The library wraps the API endpoints and provides a strongly-typed, easy-to-use interface for making API calls from your .NET applications.

Alt text

Table of Contents

Features

  • Easy integration with SonarCloud API
  • Strongly-typed responses
  • Supports .NET Core applications
  • Asynchronous API calls
  • Error handling and logging

Installation

To install the package, use the following command in your .NET Core project:

dotnet add package PMDEvers.SonarCloud.NET

Alternatively, you can add it manually to your .csproj file:

<PackageReference Include="PMDEvers.SonarCloud.NET" Version="0.1.0" />

Usage

Here are some basic examples of how to use the library:

Initializing the Client

First, initialize the SonarCloudClient with your SonarCloud token:

using SonarCloud.NET;
using SonarCloud.NET.Extensions;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddSonarCloudClient(o => {
    o.AccessToken = "<sonarcloud-token-here>";
});

Listing Projects

To fetch information about a specific project:

var result = await client.Projects.Search(new() { 
    Organization = "my-org"
    });

foreach(var project in result.Components) 
{
    Console.WriteLine(project.Name);
}

For console applications

If you're using writing a script or console application:

public static async Task Main(string[] args) 
{
    var sc = new ServiceCollection();
    sc.AddSonarCloudClient(cfg => cfg.AccessToken = MY_API_KEY);
    sc.AddLogging();
    var provider = sc.BuildServiceProvider();
    var sonarClient = provider.GetService<ISonarCloudApiClient>();
}

Configuration

Authentication

You must provide a SonarCloud token to authenticate your requests. You can generate a token from your SonarCloud account under the Security section.

Handling API Limits

Be mindful of the API rate limits imposed by SonarCloud. The client includes built-in handling for rate limit responses, but you should design your application to respect these limits and implement retry logic as needed.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any bugs or have feature requests.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1-alpha0008 36 9/25/2024
0.0.1-alpha0007 88 9/17/2024
0.0.1-alpha0006 56 9/17/2024
0.0.1-alpha0005 188 9/10/2024
0.0.1-alpha0004 49 9/7/2024
0.0.1-alpha0003 45 8/27/2024
0.0.1-alpha0002 127 8/27/2024
0.0.1-alpha0001 63 7/26/2024