Skip to content

Architecture

Here is an overview of the dbLinter components and their major data flows.

flowchart
    subgraph Cloud ["⛅ Cloud"]
        Repo[(Repo)] <--> GUI([Web GUI])
        Repo <--> REST-API(REST-API)
        REST-API --rules--> Rule-Site([Static
                                      Rule Site])
        click Repo "#repo"
        click GUI "#web-gui"
        click REST-API "#rest-api"
        click Rule-Site "#static-rule-site"
    end

    subgraph Client ["💻 Local⠀⠀⠀⠀⠀⠀⠀"]
        LS[[Language
            Server]] <--> CLI(CLI)
        LS <--> VSCode(VS Code
                       Extension)
        LS <--> SonarQube(SonarQube
                          Plugin)
        click LS "#language-server"
        click CLI "#cli"
        click VSCode "#vs-code-extension"
        click SonarQube "#sonarqube-plugin"
    end

    REST-API --config---> LS
    LS --ignore--> REST-API

Cloud components are installed on servers managed by United Codes and Grisselbav.

The dbLinter repository is implemented using the PinkDB paradigm with an Oracle AI Database 26ai. For example, this means that the Web GUI and the REST-API access the database via dedicated users based on the principle of least privileges.

The following data areas are maintained in the repo:

  • Users
  • Tenants
  • Rules
  • Validators (implemetation of checks and quick fixes)
  • Configurations
  • Runtime information (sessions, logs)

The dbLinter Web GUI is built with Oracle APEX. It is used for managing tenant-specific data, such as rules, configurations and user access.

The dbLinter REST-API is a SpringBoot application. It is an internal API used only by other dbLinter components. The following subjects are covered:

SubjectCommunication viaDescription
EmailJMSSend e-mails via Oracle AQ and Spring Mail.
RulesRESTGet the rules for generating the static rules site.
ConfigRESTGet the configuration to run checks and SQL-based tests.
IgnoreRESTAdd test result to be ignored in subsequent runs.

All REST-API calls require authentication using an API key consisting of the tenant name, the user’s email address and a personal access token.

The dbLinter Static Rule Site is generated daily using Svelte and the latest public rules from the dbLinter repository.

This website provides access to the dbLinter rules independently of the dbLinter tool suite, making it easier to reference rules such as G-9601: Never user unknown hints.

However, it is recommended that you access the rules via the Web GUI, since you can easily log in and add or remove rules from the configuration. Furthermore, you can manage private (tenant-specific) rules in the same way. Here is the link to the same rule in the Web GUI: G-9601: Never user unknown hints.

Local components run on machines controlled by the dbLinter users.

Please note that your code is always analysed locally. This means it never leaves the local network.

The dbLinter Language Server implements a subset of Microsoft’s Language Server Protocol (LSP) using Eclipse LSP4J. The Language Server is embedded in the CLI and the SonarQube Plugin.

The following LSP methods are implemented:

MethodDescription
initializeInitialize the language server.
shutdownClose the dbLinter session and free resources.
exitExit the language server.
workspace/didChangeConfigurationApply a configuration according to the client settings.
textDocument/diagnosticGet the issues for an URI.
textDocument/didOpenAdd an URI and its content to the cache.
textDocument/didChangeUpdate the content of an URI in the cache.
textDocument/didCloseRemove an URI from the cache.
textDocument/codeActionGet the quick fixes for a text range of an URI.
codeAction/resolveApply a quick fix.

Additionally, the Language Server implements the following non-standard JSON-RPC methods used by the VS Code Extension, the CLI and the SonarQube Plugin:

MethodDescription
dbLinter/testsGet all SQL-based tests.
dbLinter/runTestRun a SQL-based test.
dbLinter/ignoreTestResultsSave test results to be ignored.
dbLinter/hasFeatureCheck if a dbLinter feature is enabled.
dbLinter/isConfigLoadedCheck if the configuration is loaded.
dbLinter/isUriIncludedCheck if a given URI is in the scope.
dbLinter/plsqlMetricGet the PL/SQL metrics for a given URI.
dbLinter/rulesGet all rules.

The dbLinter Command Line Interface (CLI) is a SpringBoot application. It can start a language server and run checks and SQL-based tests, producing various output formats. The CLI is included in the VS Code Extension, but it can also be used standalone, for example within a CI/CD pipeline.

The dbLinter VS Code Extension can be installed in any IDE that implement the Visual Studio Code Extension API.

The extension provides rule violations and quick fixes for given URIs via the included language server. It further can run SQL-based tests and CLI commands.

The dbLinter SonarQube Plugin can be installed in the free SonarQube Community Build as well as in any commercial SonarQube Server edition.

The plugin is used by the SonarQube Scanner to analyse code and show the results on the SonarQube Server web application.