Skip to content

Bazel 7 and Sonarlint don't play nice #159

Open
@Attempt3035

Description

@Attempt3035

Hey all!
I've just spend a few hours endlessly searching to figure out why on earth Sonarlint randomly stopped working. My setup uses vscodium, clangd and sonarlint for quite a nice c++ development setup. After much searching, I figured out the issue was in the compile commands, which had changed not due to an update in this tool, but instead from when I updated from bazel 6.4.0 to 7. The key difference is this:
Compile commands with this tool AND BAZEL 6.4 ends up having clang as the compiler on my setup (first line of args)
"arguments": [ "clang",
Where as Bazel 7 ends up as:
"arguments": [ "external/bazel_tools~cc_configure_extension~local_config_cc/cc_wrapper.sh",

Sonarlint says "I have no idea what this compiler is, I won't lint any of your code anymore"
I don't think it's on Sonarlint to come up with a solution, and Bazel presumably has a good reason for having the wrapper in-between? Has anyone else come across this issue yet, and any ideas on how we might be able to solve it? Maybe we can extract what compiler the wrapper decides to use, or guess via some other method?

At the moment I've got a .bazelversion file with contents 6.4.0 so that bazelisk gets everything playing nicely for now😅

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions