npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nx-sonarqube

v1.0.0

Published

![logo](https://i.ibb.co/R0bzqtP/nx-sonarqube.png)

Downloads

2,628

Readme

@koliveira15/nx-sonarqube

logo

About

A Nx plugin that scans projects using SonarQube / SonarCloud.

graph

To analyze project "app", we need to know the its dependencies and sub-dependencies. Using the Nx project graph, we see that this project has five dependencies, four static and one implicit. With this information, the plugin gathers the source and coverage paths for the analysis.

Sources:

  • apps/app/src
  • libs/lib-b/src
  • libs/lib-c/src
  • libs/libs-d/src
  • libs/libs-e/src
  • libs/libs-f/src

lcov Paths:

  • coverage/apps/app/lcov.info
  • coverage/libs/lib-b/lcov.info
  • coverage/libs/lib-c/lcov.info
  • coverage/libs/libs-d/lcov.info
  • coverage/libs/libs-e/lcov.info
  • coverage/libs/libs-f/lcov.info

Usage

Prerequisites

  1. Nx workspace
  2. SonarQube or Sonar Cloud instance
  3. Jest tests & code coverage enabled

Installation

  1. Install the package:
    npm i -D @koliveira15/nx-sonarqube
  2. Execute the configuration generator to setup sonar for a given project:
    npx nx g @koliveira15/nx-sonarqube:config
  3. Execute the sonar target for the given project:
    npx nx sonar my-project
    or
    npx nx affected --target sonar --parallel 1
    Note: Due to limitations with the scanner, you cannot run more than one scan in parallel

Authentication

Sonar can require authentication credentials. You can set these via environment variables using Nrwl's Nx recipe

SONAR_LOGIN: The authentication token or login of a SonarQube user with either Execute Analysis permission on the project or Global Execute Analysis permission

SONAR_PASSWORD: If you're using an authentication token, leave this blank. If you're using a login, this is the password that goes with your SONAR_LOGIN username

Customization

Modify the executor options based on the configuration table below. These options are based on Analysis Parameters

| Name | Required | Description | Default | | ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | | hostUrl | Yes | Sonar server URL | http://localhost:9000 | | projectKey | Yes | The project's unique key. Allowed characters are: letters, numbers, -, _, . and :, with at least one non-digit. | | | branches | No | Include branch name in analysis | false | | exclusions | No | Files to exclude from coverage | | | organization | No | Sonar organization | | | projectName | No | Name of the project that will be displayed on the web interface | | | projectVersion | No | The project version. | this will default to the package.json version of the app/lib, otherwise it will take the root version | | qualityGate | No | Forces the analysis step to poll the SonarQube instance and wait for the Quality Gate status | true | | qualityGateTimeout | No | Sets the number of seconds that the scanner should wait for a report to be processed | 300 | | skipImplicitDeps | No | Skips adding implicit dependencies to the project graph analysis | false | | testInclusions | No | Comma-delimited list of test file path patterns to be included in analysis. When set, only test files matching the paths set here will be included in analysis | */.spec.ts | | verbose | No | Add more detail to both client and server-side analysis logs | false | | extra | No | A key value pair for any extra sonar variable that is not included in the list above | |

In Addition, the plugin recognizes any environment variable that is prefixed by SONAR and will add it to the sonar executor variables. For example the environment variable SONAR_LOG_LEVEL=DEBUG will be recognized as sonar.log.level=DEBUG