asmodeus812 / coc-sonarlint

GNU General Public License v3.0
3 stars 0 forks source link

Missing rules for C file #5

Open mMontu opened 1 month ago

mMontu commented 1 month ago

Hi, thanks for providing this plugin! Just installed it, and noticed it works well with python and C.

I've noticed that despite it display some issues for C files, such as

"Remove the commented out code. (sonarlint c:S125)"
"data argument not used by format string (sonarlint c:S3457)"

, it does not show some others, such as Using "strcpy" or "wcscpy" is security-sensitive, even if the issue is clearly in the code:

char *str_cpy = malloc(length);
strncpy(str_cpy, str_cpy, length);
strcpy(str_cpy, str_cpy);
strcpy(str_cpy, null);

Any ideas on how to fix (or debug) this problem? It seems there is no output, even with sonarlint.output.showVerboseLogs and sonarlint.output.showAnalyzerLogs enabled.

asmodeus812 commented 1 month ago

Hi, Have you checked if the rule is enabled in the list of rules by default? The extension provides actions to check all rules or for specific language. If you do not see it there, it might be either sonarls bug or the rule is introduced in a newer version of sonarls than the one built in the extension.

mMontu commented 1 month ago

I saw it is on the list following the link "C rules" on the README of this repo. The results are the same with the latest sonarls (using the sonarlint.ls.directly option).

Searching the rule code S5801 on the sonarls provided by this extension shows some results, such as analyzers/org/sonar/l10n/cpp/rules/RulesList.json -- it seems it is known to the language server. So I guess it is a sonarls bug.

Thanks