API to return Cyclomatic complexity count and function name

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube Enterprise Edition Version 8.9 (build 43852)

  • what are you trying to achieve
    we need to track C language functions’ cyclomatic complexity count.
    do you have some APIs for this ? a suggested sample return JSON can be:
    “function_name”: function_name,
    “cyclomatic_complexity_count”: cyclomatic_complexity_count_of_function

  • what have you tried so far to achieve this
    currently we can get some contents with
    while it do not tell us function name.


We simply don’t store metrics below the file level, so this won’t be available for every method/function.

However, there are rules that raise issues when complexity is over the configured threshold. You could set your threshold to 0 to get an issue (and in it a value) for every function. However, as you’ve noted, issues records include file and line number and not (necessarily) function.

If you really want this data, you could use file and line to look up function name.

Would you mind sharing your use case?