Missing file extension when analysing abap using sonarlint connected to Sonarcloud

  • versions used: SonarCloud and Sonarlint for Eclipse 4.0.0.201810170711 and SAP Abap Development Tools 2.102.4
  • error observed: Abap classes does not get analysed. Looking at the sonarlint console it looks like it is analysing files with the extensions .abap, .asprog, .flow, .ab4. However the SAP Abap plugin saves classes as .aclass which does not get analysed.
  • steps to reproduce: Open and edit abap class, it does not get analysed

Here’s the output in SonarLint console.

Connected mode (using configuration of 'SAP-Sandbox-CI' in server 'SonarCloud/yyyyyyyyyy)
Starting analysis with configuration:
[
  projectKey: SAP-Sandbox-CI
  baseDir: C:\Users\matti\eclipse-workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\TCU_200_matti_en\org.sonarlint.eclipse.core\sonarlint3187856588688395169
  workDir: C:\Users\matti\eclipse-workspace\.metadata\.plugins\org.eclipse.core.resources\.projects\TCU_200_matti_en\org.sonarlint.eclipse.core
  extraProperties: {}
  inputFiles: [
    semanticfs:/TCU_200_matti_en/.adt/classlib/classes/zac_kontaktperson_factory/zac_kontaktperson_factory.aclass (UTF-8)
  ]
]

Extension com.sonarsource.plugins.license.api.LicensedPluginRegistration was blacklisted as it is not used by SonarLint
Extension com.sonar.swift.plugin.SwiftProfile was blacklisted as it is not used by SonarLint
Available languages:
  * C => "c"
  * C++ => "cpp"
  * Objective-C => "objc"
  * Python => "py"
  * Kotlin => "kotlin"
  * T-SQL => "tsql"
  * Apex => "apex"
  * JavaScript => "js"
  * PL/SQL => "plsql"
  * Ruby => "ruby"
  * Scala => "scala"
  * Java => "java"
  * HTML => "web"
  * PHP => "php"
  * TypeScript => "ts"
  * ABAP => "abap"
  * Swift => "swift"
Start analysis
Declared extensions of language C were converted to c: **/*.disabled
Declared extensions of language C++ were converted to cpp: **/*.disabled
Declared extensions of language Objective-C were converted to objc: **/*.disabled
Declared extensions of language Python were converted to py: **/*.py
Declared extensions of language Kotlin were converted to kotlin: **/*.kt
Declared extensions of language T-SQL were converted to tsql: **/*.tsql
Declared extensions of language Apex were converted to apex: **/*.cls,**/*.trigger
Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue
Declared extensions of language PL/SQL were converted to plsql: **/*.sql,**/*.tab,**/*.pkb
Declared extensions of language Ruby were converted to ruby: **/*.rb
Declared extensions of language Scala were converted to scala: **/*.scala
Declared extensions of language Java were converted to java: **/*.java,**/*.jav
Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.jspf,**/*.jspx,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml,**/*.jsp
Declared extensions of language PHP were converted to php: **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
Declared extensions of language TypeScript were converted to ts: **/*.ts,**/*.tsx
Declared extensions of language ABAP were converted to abap: **/*.abap,**/*.ab4,**/*.flow,**/*.asprog
Declared extensions of language Swift were converted to swift: **/*.swift
Index files
1 files indexed
Quality profiles:
  * abap: AWc7TzZIVkO6GYww2HZ0 (64 rules)
  * apex: AWeIT61zejOaZOEeDtQz (29 rules)
  * c: AWbzjNqjhAMvTEvF4szX (132 rules)
  * cpp: AWbzjNqjhAMvTEvF4szq (203 rules)
  * java: AWbzjNqjhAMvTEvF4szl (344 rules)
  * js: AWbzjNqjhAMvTEvF4szo (89 rules)
  * kotlin: AWbzjNqjhAMvTEvF4szb (30 rules)
  * objc: AWbzjNqjhAMvTEvF4szr (123 rules)
  * php: AWbzjNqjhAMvTEvF4szn (85 rules)
  * plsql: AWbzjNqjhAMvTEvF4sze (119 rules)
  * py: AWbzjNqjhAMvTEvF4szY (32 rules)
  * ruby: AWbzjNqjhAMvTEvF4szV (29 rules)
  * scala: AWbzjNqjhAMvTEvF4szW (28 rules)
  * swift: AWbzjNqjhAMvTEvF4szh (60 rules)
  * ts: AWbzjNqjhAMvTEvF4szj (54 rules)
  * tsql: AWbzjNqjhAMvTEvF4sza (54 rules)
  * web: AWbzjNqjhAMvTEvF4szf (18 rules)
'JavaSquidSensor' skipped because there is no related file in current project
'CFamily' skipped because there is no related file in current project
'Python Squid Sensor' skipped because there is no related file in current project
'Kotlin Sensor' skipped because there is no related file in current project
'SonarJS' skipped because there is no related file in current project
'PL/SQL Sensor' skipped because there is no related file in current project
'Ruby Sensor' skipped because there is no related file in current project
Execute Sensor: SonarJavaXmlFileSensor
Execute Sensor: HTML
'PHP sensor' skipped because there is no related file in current project
'Analyzer for "php.ini" files' skipped because there is no related file in current project
'Contextual SonarTS' skipped because there is no related file in current project
'AbapSquidSensor' skipped because there is no related file in current project
'SonarSwift' skipped because there is no related file in current project
Found 0 issue(s)
Done in 83 ms

Hi,

SonarAbap analyser read the configuration property sonar.abap.file.suffixes to determine which files to analyse. By default on SonarCloud, the property value is .abap,.ab4,.flow,.asprog, and in your case you should add ,.aclass to this list.

I don’t recommend to add this property in your local SonarLint settings, because only SonarLint would benefit from it. Same problem with adding a parameter to sonar-scanner -Dsonar.abap.file.suffixes=.abap,.ab4,.flow,.asprog,.aclass, because only SonarCould would benefit from it.

So my recommendation would be to change it through the administration section of your SonarCloud project (General Settings/ABAP/File suffixes), and to ensure the change is taken into account at the same time in SonarLint, do a SonarLint “Update binding”.

Alban

2 Likes

Thank you, I’ve added it to the project and it seems to work. Thank you
Mattias