Use providers and rule conditions to analyze code with the Language Server Protocol (LSP). {ProductShortName} includes built-in and language-specific providers; the when block in a rule defines matching conditions.
Currently, {ProductShortName} supports the following providers:
-
Builtin
-
Java
-
Go
-
External providers (for
Python,DotnetandNode.jsapplications) initialized by the generic provider binary
|
Note
|
You can use the generic provider binary to create an external provider for any language that is compliant with LSP 3.17 specifications. |
In a rule, the when block is where the conditions for matching the rule are specified. Each provider offers a series of capabilities to do matching.. The search query in the rule condition can contain patterns, code locations, specific dependencies to be found, and so on, to evaluate the source code and dependencies. The provider sends the LSP server a request to check the search query against the application being analyzed. When the LSP server returns a match for the search in the source code, the analyzer triggers a violation.
The syntax for the when block is as follows: contains one condition, but that condition can have multiple conditions nested under it.
when:
<condition>
<nested-condition>