Awesome Go

sonarqube-client-go

CategoryThird-party APIs
SubcategoryThird-party APIs
Stars6

Go client library and command-line client for the SonarQube Web API

About sonarqube-client-go

SonarQube Go Client

Go Reference codecov License

A comprehensive, type-safe Go client library and command-line interface for the SonarQube Web API. Whether you're building automation tools, integrating SonarQube into your CI/CD pipeline, or managing your SonarQube instance from the terminal - this project has you covered.

๐Ÿ“– Documentation: https://boxboxjason.github.io/sonarqube-client-go/ ยท ๐Ÿ“š API reference: pkg.go.dev

Watch the sonarqube-client-go video

Features

  • Go SDK: strongly typed options and responses for every SonarQube V1 and V2 API service, token or basic authentication, opt-in retries with backoff, HTTP middleware for logging and tracing.
  • CLI (sonar-cli): every service and method as a subcommand, JSON / YAML / table output, automatic pagination with --all, shell completion.
  • Tested with unit tests and integration tests against real SonarQube Community and Enterprise instances.

Quick start

CLI

go install github.com/boxboxjason/sonarqube-client-go/v2/cmd/sonar-cli@latest

export SONAR_CLI_URL=https://sonar.example.com
export SONAR_CLI_TOKEN=mytoken
sonar-cli issues search --projects my-project --severities CRITICAL,MAJOR --all

Go SDK

go get github.com/boxboxjason/sonarqube-client-go/v2/sonar
client, err := sonar.NewClient(nil,
	sonar.WithBaseURL("https://sonarqube.example.com/api/"),
	sonar.WithToken("my-token"),
)
if err != nil {
	log.Fatal(err)
}

projects, _, err := client.Projects.Search(context.Background(), &sonar.ProjectsSearchOptions{
	Query: "my-service",
})

The documentation covers the CLI, the SDK, client configuration, errors and pagination and the list of services. It is built from the docs directory, and updated together with the code.

Contributing

Contributions are welcome: read the Contributing Guide, which covers the development setup, the tests and the documentation.

Reporting Issues

  • Report a bug with the steps to reproduce, the Go, OS and SonarQube versions, and a minimal reproducer.
  • Request a feature.
  • Do not open a public issue for a security vulnerability: email the maintainers privately with the details.

License

Licensed under the Apache License 2.0, see LICENSE.

Frequently Asked Questions

What is sonarqube-client-go?

sonarqube-client-go is a Third-party APIs library for the Go programming language. Go client library and command-line client for the SonarQube Web API

How do I install sonarqube-client-go?

Install sonarqube-client-go with the Go module system using `go get BoxBoxJason/sonarqube-client-go`. Check the repository for the current installation instructions.

What category does sonarqube-client-go belong to?

sonarqube-client-go is listed under Third-party APIs, specifically Third-party APIs.

โ† Back to Third-party APIs