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

coc-sonarlint

v0.0.17

Published

Coc sonar lint language server extension client

Downloads

442

Readme

SonarLint for Coc.nvim

SonarLint by Sonar is a free IDE extension that empowers you to fix coding issues before they exist. More than a linter, SonarLint detects and highlights issues that can lead to bugs, vulnerabilities, and code smells as you create your code. It offers clear remediation guidance and educational help, so you can fix issues before the code is committed. Out of the box, SonarLint in Coc supports analysis of JS/TS, Python, PHP, Java, C, C++, C#, Go, and IaC code locally in your IDE.

Sonar's Clean Code solutions help developers deliver high-quality, efficient code standards that benefit the entire team or organization.

How it works

Simply open any source file, start coding, and you will start seeing issues reported by SonarLint. Issues are highlighted in your code You can access the detailed rule description directly from your editor, using the provided contextual menu.

Static Analysis Rules

Out of the box, SonarLint automatically checks your code against the following rules:

Requirements

The SonarLint language server needs a Java Runtime (JRE) 17+. If you do not have one provided in your path, please install it first. Below you will find the details on how to setup your environment

  1. the sonarlint.ls.javaHome variable in Coc settings if set. For instance:
{
    "sonarlint.ls.javaHome": "C:\\Program Files\\Java\\jdk-17"
}
  1. embedded JRE for platform-specific installations
  2. the value of the JDK_HOME environment variable if set
  3. the value of the JAVA_HOME environment variable if set
  4. on Windows the registry is queried
  5. if a JRE is still not found then:
  6. the PATH is scanned for javac
  7. on macOS, the parent directory of javac is checked for a java_home binary. If that binary exists then it is executed and the result is used
  8. the grandparent directory of javac is used. This is similar to $(dirname $(dirname $(readlink $(which javac))))

SonarLint then uses the first JRE found in these steps to check its version. If a suitable JRE cannot be found at those places, SonarLint will ask for your permission to download and manage its own version.

This extension also provides a custom root directory where the sonar lint binaries are to be found, in case you do not desire to use the one bundled with this extension

{
    "sonarlint.ls.directly": "/home/yourname/sonarlint"
}

Sonarlint will try to prompt you when a compile commands in c or cpp projects is not found, to disable that feature globally, and ignore the missing compile commands you can set the following property in your coc-settings.json

{
    "sonarlint.notifyMissingCompileCommands": false
}

The directory must contain two folders, a server/ and analyzers/, where the server binary is located in the server/ folder and all analyzer binaries are located in the analyzers/ folder

JS/TS analysis specific requirements

To analyze JavaScript and TypeScript code, SonarLint requires a Node.js executable. The minimal supported version is 18.18 for standalone analysis or Connected Mode with SonarCloud. For Connected Mode with SonarQube, it depends on the version of the JS/TS analyzer on your SonarQube server. SonarLint will attempt to automatically locate Node, or you can force the location using:

{
  "sonarlint.pathToNodeExecutable": "/home/yourname/.nvm/versions/node/v18.18.0/bin/node"
}

Analysis of TypeScript in Connected Mode with SonarQube requires the server to use version 8.1 or above.

C and C++ analysis specific requirements

To analyze C and C++ code, SonarLint requires compile commands json file

{
  "sonarlint.pathToCompileCommands": "/home/yourname/repos/proj/compile_commands.json"
}

Note: if you are using Microsoft compiler, the environment should be ready to build the code.

Java analysis specific requirements

To enable the support for Java analysis, you need the coc-java or any coc-java compliant extension

Jupyter notebooks

SonarLint for Coc supports analysis of Python code inside Jupyter notebooks.

Other settings

It is possible to specify extra analyzer properties that will be used for analysis. Example:

{
  "sonarlint.analyzerProperties": {
    "sonar.javascript.node.maxspace": "4096",
  }
}

Contributions

Have a need in SonarLint that’s not being met? Or not being met well? Ever wish you could talk directly to the Product Manager? Well now’s your chance! Congratulations, you are SonarLint’s Product Manager for a day. If you would like to see a new feature, please create a new thread in the Community Forum here, under "Product Manager for a Day".

With that in mind, if you would like to submit a code contribution, please create a pull request for this repository. Please explain your motives to contribute: what problem you are trying to fix, what improvement you are trying to make.

License

Copyright 2017-2024 SonarSource.

Licensed under the GNU Lesser General Public License, Version 3.0