Sonarlint is not scanning .inc file in Eclipse

Hi Team,

Sonarlint plugin is not scanning .inc file extension in Eclipse IDE. We have added the following settings in sonarlint property but still not scanning.

sonar.php.file.suffixes = .php,.module,.inc,.install,.info

Thanks
Sudhakar D

Hi @dnsudhakar

I managed to reproduce the issue, and tracked it down to our CDT (C/C++) integration, that is forcing .inc files to be considered as C/C++ files. Do you confirm this is the same root cause for you? You can verify by enabling analysis + verbose mode in the SonarLint console:

Starting analysis with configuration:
[
  baseDir: /home/julien/Prog/runtime-EclipseApplication/Foo
  extraProperties: {}
  excludedRules: []
  includedRules: []
  inputFiles: [
    file:/home/julien/Prog/runtime-EclipseApplication/Foo/src/foo.inc (UTF-8) [cpp]
  ]
]

Available languages:
  * PHP => "php"
  * Python => "py"
  * Java => "java"
  * HTML => "web"
  * JSP => "jsp"
  * JavaScript => "js"
Start analysis
Declared extensions of language PHP were converted to php: **/*.php,**/*.php3,**/*.php4,**/*.php5,**/*.phtml,**/*.inc
Declared extensions of language Python were converted to py: **/*.py
Declared extensions of language Java were converted to java: **/*.java,**/*.jav
Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml
Declared extensions of language JSP were converted to jsp: **/*.jsp,**/*.jspf,**/*.jspx
Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue
Index files
Language of file 'file:/home/julien/Prog/runtime-EclipseApplication/Foo/src/foo.inc' is set to 'cpp'

The two interesting points are:

inputFiles: [file:/home/julien/Prog/runtime-EclipseApplication/Foo/src/foo.inc (UTF-8) [cpp] ]

and

Language of file ‘file:/home/julien/Prog/runtime-EclipseApplication/Foo/src/foo.inc’ is set to 'cpp’

@Julien_HENRY

Thanks for your quick response.

This is not relevant to our request.

We are using Drupal CMS (PHP) in Eclipse IDE with sonarlint plugin. In drupal CMS lot of extenstions are available like .module, .install, .info, .inc, .php sonarlint is scan all extension except .inc file. Please help us how to configure/scan .inc extension in Eclipse IDE with sonarlint plugin.

Thanks,
Sudhakar D

Then can you share the SonarLint console content, after enabling verbose + analysis logs, and then trigger an analysis.

@Julien_HENRY

Here is my console log

Trigger: MANUAL
Clear markers on 0 excluded files
SonarLint processing file /intelliji/docroot/sites/all/modules/custom/enfa_mobile_services/includes/enfa_article_services.services.inc...
Standalone mode (project not bound)
Starting analysis with configuration:
[
  baseDir: C:\xampp\htdocs\MJN\intelliji
  extraProperties: {sonar.php.file.suffixes=.php,.inc,.module,.install}
  excludedRules: [python:InequalityUsage, squid:S1301, squid:S2755, squid:S2639, squid:S2757, squid:S2638, squid:S2637, squid:S3725, squid:ObjectFinalizeOverridenCheck, python:S1066, squid:S2885, squid:S3973, squid:S2886, squid:S3972, squid:S2761, squid:S1319, squid:S2647, squid:S1317, squid:UselessParenthesesCheck, squid:S3822, squid:S2975, squid:S1643, squid:S1764, squid:S1640, squid:S2970, squid:S2976, squid:S2737, squid:S3824, squid:ObjectFinalizeCheck, squid:S2864, squid:AssignmentInSubExpressionCheck, squid:S2629, squid:S4929, squid:S3959, squid:S4925, squid:S1656, squid:S3958, squid:S1659, squid:S2681, squid:S2676, squid:S1223, squid:S2675, squid:S1226, squid:S2677, squid:S1220, squid:S3400, squid:S4973, squid:S2674, squid:S1221, squid:S2438, squid:S4738, squid:S2437, squid:S2692, squid:S1481, squid:S1598, squid:S2445, squid:CallToDeprecatedMethod, squid:S3415, squid:S1479, squid:S2326, squid:S2447, squid:S2689, squid:S2204, squid:S2446, squid:S3655, squid:S3776, squid:S2441, squid:S2440, squid:S1596, squid:S2201, squid:S2200, squid:S2442, squid:S1118, squid:S2209, squid:S3416, squid:CommentedOutCodeLine, squid:S1444, squid:S3986, squid:S1201, squid:S2653, squid:S3984, squid:S3864, squid:S3985, squid:S3981, squid:S4719, squid:S1206, squid:S4838, squid:S3626, squid:ForLoopCounterChangedCheck, squid:S2786, squid:S4602, squid:S1215, squid:S3753, squid:S1214, squid:S4601, squid:S3751, squid:S1450, squid:S3510, squid:S3631, squid:S3752, squid:S1210, squid:S1452, squid:S1217, squid:S2789, squid:S3518, squid:S1219, squid:S3878, squid:S3516, squid:S1940, squid:S1948, squid:S1700, squid:S2912, squid:MissingDeprecatedCheck, squid:S1710, squid:S2925, squid:S2924, squid:S4087, squid:ObjectFinalizeOverridenCallsSuperFinalizeCheck, squid:S1862, squid:S1860, squid:S2718, squid:S1989, squid:S3923, python:S1700, squid:S1994, squid:S1751, squid:S1872, squid:MaximumInheritanceDepth, squid:S1871, squid:S1607, squid:S1849, squid:S1602, squid:S1844, squid:S1604, squid:S1845, squid:HiddenFieldCheck, python:ExecStatementUsage, squid:S1611, squid:S1610, squid:S1858, squid:S1612, squid:S1854, squid:ModifiersOrderCheck, squid:S4143, python:S1871, squid:S4144, squid:S4499, squid:S5344, squid:S3046, squid:S899, squid:S3065, squid:S4275, squid:S2095, squid:S3066, squid:S4034, squid:S4276, python:S1862, squid:S2097, squid:S3064, squid:S4032, squid:S4274, python:S2711, squid:S5361, squid:S2094, python:S2712, squid:S2093, squid:S2184, squid:S2062, squid:S2183, squid:S2065, squid:S2186, squid:S2185, squid:UnusedPrivateMethod, squid:S2061, squid:S2060, python:S1845, squid:EmptyStatementUsageCheck, squid:S3027, squid:S2177, squid:S2055, squid:S2176, squid:S2178, squid:S3042, squid:S3281, squid:RedundantThrowsDeclarationCheck, squid:S3038, python:S1716, squid:S3039, squid:S2188, squid:S4488, python:PrintStatementUsage, squid:S2066, squid:S2187, squid:S3034, squid:S2068, squid:S2189, squid:S3398, python:S125, squid:S4065, python:S1313, squid:S1905, python:S116, python:S117, python:S1542, squid:S5164, python:S107, python:S108, squid:S4165, squid:S3077, python:S101, squid:S4042, python:S100, python:S1656, squid:S3067, python:S1763, python:S1764, python:S2733, squid:S5261, python:S2734, squid:S3078, squid:SwitchLastCaseIsDefaultCheck, squid:S128, python:S1110, squid:S1150, squid:S3330, python:S3776, squid:S2115, squid:S2236, squid:S2114, squid:S2235, squid:S1149, squid:S1148, squid:S2116, squid:S1143, squid:S1264, squid:S2111, squid:S2232, squid:S2110, squid:S2234, squid:S2112, squid:S2119, squid:S2118, squid:S1161, squid:S1163, squid:S2131, squid:S2252, squid:S2130, squid:S2251, squid:S1158, squid:S4426, squid:S1157, squid:S4424, squid:S2127, squid:S3457, squid:S4425, squid:S2122, squid:S1153, squid:S2121, squid:S4423, squid:S1155, squid:S2123, squid:S135, squid:S2129, squid:LabelsShouldNotBeUsedCheck, squid:S106, squid:S00100, squid:S00101, squid:S1125, squid:S1488, squid:S4635, squid:S3305, squid:S1126, squid:S2699, squid:S3421, squid:S3422, squid:S2696, squid:S2695, squid:S00108, squid:S00107, squid:S4517, squid:S00112, python:S2772, squid:S1141, squid:S2230, squid:S2225, squid:S3436, squid:S1135, squid:S2226, squid:S2589, squid:S4524, squid:S2583, squid:S1134, squid:S3551, squid:S1133, squid:S2222, squid:S00115, squid:S00114, squid:S00117, squid:S00116, squid:S00119, squid:S2229, squid:S3438, squid:S2109, squid:S3439, squid:S00120, squid:S3010, squid:S3252, squid:S1193, squid:S3374, squid:UselessImportCheck, squid:S1075, squid:S1195, squid:S1190, squid:S1192, squid:S2160, squid:S1191, squid:S2159, squid:S3008, squid:S1066, squid:S2276, squid:S1065, squid:S1186, squid:S2154, squid:S2275, squid:S1068, squid:S2157, squid:S2278, squid:S2277, squid:S4454, squid:S2293, squid:S2175, squid:S3020, squid:S4351, squid:S4349, squid:S4347, squid:S4348, squid:S2166, squid:S3014, squid:S1197, squid:S2165, squid:S2168, squid:S3012, squid:S1199, squid:S2167, squid:S1172, squid:S2140, squid:S4682, python:S1134, squid:S1171, squid:S1174, squid:S2142, squid:S1170, squid:S2258, squid:S1168, squid:S2139, squid:S3346, squid:S4435, squid:S2259, squid:S1165, squid:S2133, squid:S2254, squid:S4433, squid:S4434, squid:S2134, squid:S4432, python:BackticksUsage, python:S1481, squid:S2151, squid:S2272, squid:S1182, squid:S1185, squid:S2153, squid:S2274, squid:S2273, squid:S1181, squid:S2391, squid:ClassVariableVisibilityCheck, squid:S2390, squid:S2147, squid:S4449, squid:S3599, squid:S3358, python:PreIncrementDecrement, squid:S2386, squid:S3355, squid:S1175, squid:S5413, squid:S2388, squid:S4684, squid:S2387, squid:S4201, squid:S5411]
  includedRules: [php:S2003, php:S3335, javascript:S2392, php:S1793, php:S2002, php:S3336, php:S2005, php:S3333, php:S1311, php:S3334, javascript:S2550, javascript:S3760, php:S1151, php:S3332, php:S2001, javascript:S2310, javascript:S3003, php:S2000, javascript:BoundOrAssignedEvalOrArguments, php:S4142, javascript:S3402, javascript:TrailingComma, javascript:S3524, javascript:S3525, javascript:S3800, javascript:S3801, javascript:S2713, javascript:S2714, javascript:S2715, javascript:S2716, php:S126, javascript:StrictMode, javascript:EqEqEq, php:S128, php:S2918, php:S1820, php:S881, php:S122, php:S1200, javascript:CommentedCode, javascript:S3353, javascript:S1451, php:S2011, javascript:AssignmentWithinCondition, javascript:S1697, javascript:S3358, javascript:S3512, javascript:ConditionalComment, javascript:S2424, javascript:S3513, javascript:S3514, javascript:S3757, javascript:LineLength, javascript:S2427, javascript:S3758, javascript:S2549, javascript:S3759, javascript:ContinueStatement, php:S134, javascript:S1105, javascript:S1226, javascript:TrailingWhitespace, javascript:HtmlComments, javascript:UnusedFunctionArgument, php:S139, javascript:S1067, javascript:ConstructorFunctionsForSideEffects, javascript:S1186, php:S2007, php:S3337, php:S1799, php:S3338, javascript:S2770, javascript:FunctionDeclarationsWithinBlocks, javascript:S2376, php:S1131, javascript:S3863, javascript:S138, javascript:S2138, javascript:S2898, javascript:SingleQuote, javascript:S3504, javascript:VariableShadowing, php:S103, php:S104, javascript:S3509, javascript:S2817, javascript:FunctionComplexity, javascript:CollapsibleIfStatements, javascript:NestedIfDepth, php:S105, php:S1808, javascript:ConditionalOperator, javascript:LabelPlacement, javascript:S1154, php:S1765, php:S100, php:S1766, php:S1541, php:S1784, javascript:S4144, php:S1781, php:S1780, javascript:S2762, javascript:ExcessiveParameterList, javascript:S3735, php:S2070, javascript:S2769, php:S113, php:S116, php:S117, php:S1779, php:S2047, javascript:TrailingComment, php:S2046, php:S2043, php:S2042, php:S1990, php:S2044, javascript:ArrayAndObjectConstructors, javascript:S2234, javascript:S3723, javascript:NamedFunctionExpression, javascript:S1135, javascript:S1134, javascript:Semicolon, php:S1105, php:S1106, javascript:CurlyBraces, javascript:S3271, php:NoSonar, php:S1124, php:S1121, php:S2050, javascript:OneStatementPerLine, javascript:S3798, javascript:MissingNewlineAtEndOfFile, javascript:S2228, javascript:ParsingError, javascript:S881, javascript:S2508, javascript:TooManyBreakOrContinueInLoop, javascript:S1145, php:S1757, php:S1996, php:S1997, php:S1451, javascript:S3786, javascript:S1488, javascript:S2611, php:S2260, javascript:ElseIfWithoutElse, javascript:S3827, javascript:VariableDeclarationAfterUsage, javascript:TabCharacter, php:S4833, php:S2036, php:S1067, php:S2038, php:S2830, php:S2037, javascript:ForIn, javascript:S3498, javascript:S2685, javascript:S3499, javascript:S3533, javascript:S1994, javascript:S3776, javascript:S104, javascript:S101, javascript:S100, javascript:S2208, javascript:SwitchWithoutDefault, javascript:S1125, php:S1578]
  inputFiles: [
    file:/C:/xampp/htdocs/MJN/intelliji/docroot/sites/all/modules/custom/enfa_mobile_services/includes/enfa_article_services.services.inc (UTF-8) [cpp]
  ]
]

Available languages:
  * PHP => "php"
  * Python => "py"
  * Java => "java"
  * HTML => "web"
  * JSP => "jsp"
  * JavaScript => "js"
Start analysis
Declared extensions of language PHP were converted to php: **/*.php,**/*.inc,**/*.module,**/*.install
Declared extensions of language Python were converted to py: **/*.py
Declared extensions of language Java were converted to java: **/*.java,**/*.jav
Declared extensions of language HTML were converted to web: **/*.html,**/*.xhtml,**/*.cshtml,**/*.vbhtml,**/*.aspx,**/*.ascx,**/*.rhtml,**/*.erb,**/*.shtm,**/*.shtml
Declared extensions of language JSP were converted to jsp: **/*.jsp,**/*.jspf,**/*.jspx
Declared extensions of language JavaScript were converted to js: **/*.js,**/*.jsx,**/*.vue
Index files
Language of file 'file:/C:/xampp/htdocs/MJN/intelliji/docroot/sites/all/modules/custom/enfa_mobile_services/includes/enfa_article_services.services.inc' is set to 'cpp'
1 file indexed
'JavaSquidSensor' skipped because there is no related file in current project
'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
'Python Squid Sensor' skipped because there is no related file in current project
'JavaXmlSensor' skipped because one of the required properties is missing
Execute Sensor: HTML
'SonarJS' skipped because there is no related file in current project
Found 0 issue(s)
Done in 103 ms 

Thanks,
Sudhakar D

OK, thanks. This is what I described in my first post: SonarLint is considering the .inc file as C++ file (see the [cpp] label in logs). I already created a ticket:
https://jira.sonarsource.com/browse/SLE-342

This will be fixed in the next release that should come this week.

Thanks for the feedback.

@Julien_HENRY

Thanks for your confirmation.

Thanks,
Sudhakar D

SonarLint Eclipse 5.0 was just released with the fix.