我们的声纳建造环境的细节如下:
* SonarQube Server Version - 5.6.6 (64-Bit).
* Sonar Client Build Operating System – Windows-7 (64-Bit).
* Sonar-scanner- Version - 3.0.3.778.
* sonar-cxx-plugin-0.9.7.jar
* sonar-csharp-plugin Version -5.11.0.1761.
* sonar-objective-c-plugin-0.5.0-SNAPSHOT.jar
* Source Code Language: C# and C++我们的SonarQube服务器是集中式服务器,所以已经安装了(cxx-plugin,objective plugin和csharp)。
当前问题:
当我们扫描代码时,如果出现以下错误,将失败。因为我们有多语言(C#和C++)代码,所以这两种语言必须一次扫描一次。
ERROR: Caused by: Language of file 'workspace/HS30/baseclasses/ametex.h' can not be decided as the file matches patterns of both sonar.lang.patterns.c++ : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h and sonar.lang.patterns.objectivec : **/*.h,**/*.m
sonar.language=cs,c++ (试过但没有成功)
所以请帮助我们解决同样的问题。
发布于 2017-06-07 13:28:56
这是一个关于哪种语言“声明”.h文件的问题。只有一种语言可以声明任何给定的文件扩展名,而目前有两种语言声明.h,因此扫描器无法确定将这些文件提供给哪个分析器,并放弃。
具体来说,从您的错误消息:
the file matches patterns of both sonar.lang.patterns.c++ : **/*.cxx,**/*.cpp,**/*.cc,**/*.c,**/*.hxx,**/*.hpp,**/*.hh,**/*.h and sonar.lang.patterns.objectivec : **/*.h,**/*.m你让cxx和objectivec都声称是.h。您必须从这两个列表之一中删除扩展名。
转到(全局) Administration > language > Language文件后缀,编辑每种语言声明的扩展,并从一种或两种语言中删除.h。
请确保不要将这些字段中的任何一个保留为空白。如果留空,将使用默认值(包括.h)。
发布于 2021-02-05 14:39:33
我使用sonar.lang.patterns.c=""来清空C扩展,并且只保留C++扩展。您需要知道要保留哪一个,例如删除sonar.lang.patterns.objectivec=""的objectiveC。
发布于 2018-01-18 07:55:56
理论上,最简单的方法是配置模式,以便*.h文件只由一种语言匹配,即设置选项sonar.lang.patterns.objectivec空。
实际上,这将是对ObjectiveC的牺牲分析,也许您可以重新考虑您的项目结构,或者运行两个分别扫描两种语言的Sonar构建?
https://stackoverflow.com/questions/44412117
复制相似问题