sonar-next / sonar-swift

sonar-swift.SonarQube iOS Plugin, Support Objective-C/Swift/Java, Support import Infer Issue (SonarQube iOS 代码扫描插件,支持 Objective-C 和 Swift / Java,支持 Infer 结果导入 ) base on https://github.com/Idean/sonar-swift
Other
221 stars 39 forks source link

增加文件后缀匹配能力 #16

Closed qiyan2019 closed 2 years ago

qiyan2019 commented 2 years ago

在使用多阶段的CI任务时候,如果这些任务运行在多个CI-Runner时候,多个阶段生成的oclint、swift、infer的结果是文件的绝对路径与sonar-scanner阶段的路径不一致,导致file not included in sonar。解决方式和findbug插件类似,遍历整个源码文件,匹配文件的后缀

sydowma commented 2 years ago

@frtmelody 感谢你的回复,并且感谢你提交的代码。 我只有几个疑问

  1. 这些代码你那边已经测试通过了吗?
  2. for (InputFile f : fs.inputFiles(fs.predicates().hasType(InputFile.Type.MAIN))) { 加上这个之后,对扫描速度有多大影响?
qiyan2019 commented 2 years ago

@frtmelody 感谢你的回复,并且感谢你提交的代码。 我只有几个疑问

  1. 这些代码你那边已经测试通过了吗?
  2. for (InputFile f : fs.inputFiles(fs.predicates().hasType(InputFile.Type.MAIN))) { 加上这个之后,对扫描速度有多大影响?
  1. 相关代码已经经过测试, 在我们使用的GilabRunner输出结果正常
  2. 排查这个问题时候看了findbugs插件相关的代码,里面也有类似的实现https://github.com/spotbugs/sonar-findbugs/blob/master/src/main/java/org/sonar/plugins/findbugs/resource/ByteCodeResourceLocator.java#L142,理论上对扫描的影响不是很大