Skip to content
Thomas Pohl edited this page Jan 1, 2020 · 15 revisions

Welcome to the sonar-esql-plugin wiki!

Prerequisite

Plugin version 1.* (deprecated)

IIB-Version: version 7 and later
Sonar-Version: 5.4.2

Plugin version 2.0.* - 2.2.* (deprecated)

IIB-Version: version 7 and later
Sonar-Version: 5.6 and later

Plugin version 2.3.*

IIB-Version: version 7 and later
Sonar-Version: 6.7 and later

Plugin version 3.*

IIB-Version: version 7 and later
Sonar-Version: 7.9 and later

Installation

  • Simply place the plugin-jar in the plugin directory of SonarQube. ($SONARQUBE_HOME\extensions\plugins)
  • Remove any previous versions of the same plugins
  • Restart your SonarQube Server

Analyzing ESQL code

Standalone using SonarQube Scanner

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner

Using Jenkins and SonarQube Scanner

https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Jenkins

Features

Checks

  • CommentRegularExpressionCheck
  • ElseIfWithoutElseCheck
  • FileNameCheck
  • FunctionNameCheck
  • IterateStatementCheck
  • LineLengthCheck
  • ModuleNameCheck
  • NestedIfDepthCheck
  • NonReservedKeywordCheck
  • OneStatementPerLineCheck
  • ParsingErrorCheck
  • ProcedureNameCheck
  • TooManyIterateOrLeaveInLoopCheck
  • TooManyLinesInFileCheck
  • UpperCaseKeywordCheck
  • UseBrokerSchemaCheck
  • VariableNameCheck
  • PropagateToLabelCheck
  • ConstantNameCheck
  • And a lot more

Requirements for new checks

  • Implement the logic in the package com.exxeta.iss.sonar.esql.check

    • The name of the Class must end with "Check"
    • The key of the rule must match the classname (excluding Check)
  • Add a JUnit Test in the package com.exxeta.iss.sonar.esql.check

    • The name of the test class must match the check class plus a suffix Test
    • The test coverage should be more than 80%
  • Add the test to the Checklist (com.exxeta.iss.sonar.esql.check)

  • Add a HTML and a JSON description of the check

    • Folder: esql-checks\src\main\resources\org\sonar\l10n\esql\rules\esql

There is a tutorial how to create new rules.