We are having false positives with .h files because they are considered C++ by Sonarlint while they are C files. They produce a lot of these issues:
Macros should not be used to define constants
“using” should be preferred for type aliasing
Scoped enumerations should be used
We have connected to a Sonarqube instance which defines the file types associated with languages and .h files are only supposed to be considered as C, but they are clearly not when coding in the IDE. The scan works fine when done only with sonar-scanner.
How can we tell CLion and/or Sonarlint that these are C files and not C++?
we use the configuration given by CLion to analyze the source file, it seems like your project is not well configured in CLion. Is it a CMake project? Did you reload the project?
The Com.h file is in a mixed language project using C and C++ with CMake. I want to analyse .h files in this project as C and not C++. Are you aware of a way in CLion to parse .h files as C and not C++?
if you have a build configuration using such .h file as C you can select it in the top-right “Active configuration” drop-down menu, which should change the configuration used to analyze the file.