Cobol scanning not enabled by default in SonarLint

OS: Windows 10
IDE: Eclipse 2021-03
SonarLint: 6.5.0
Connected Mode is used, SQ is 8.9.6 Datacenter Edition, but I guess it does not matter

I tried to scan a Cobol File, created an empty project, put a test.cbl there with some obvious issues inside it. saved the file. Progress View shows that something is triggered but no issues are found. did some debugging and identified that class org.sonarsource.sonarlint.core.client.api.common.Language has no default extension defined for Cobol. Cobol is the only programming language without a default extension in that class. any reason why this is the case?

I got it to work by adding this property in the SonarLint preferences:

According to the source this still seems to be the case in the latest SonarLint version (7.4.0), where the class was renamed to org.sonarsource.sonarlint.core.commons.Language:
COBOL("cobol", "cobol", "COBOL", new String[0], "sonar.cobol.file.suffixes")
for comparison the definition for PLI, which works out-of-the-box:
PLI("pli", "pli", "PL/I", new String[] {".pli"}, "sonar.pli.file.suffixes"),

Hey there.

Historically, COBOL hasn’t had a default language suffix because on the mainframe, COBOL files don’t have any file suffixes…

I’m not sure this stands muster because to analyze files with Sonar(Qube|Lint) you either must give the files a suffix, or set a rather obscure sonar.lang.patterns.cobol=**/* setting.

I’ve triggered a discussion about this internally – thanks for asking the question!