Facebook Infer 过滤第三方

关于Infer的说明,在此就不再赘述--> 点我查看

最近在review QA同学发来的静态扫描(使用的是FB的Infer) report的时候,发现结果里大部分都是一些第三方库(project)的issue,
为了便于RD check,决定摒弃对第三方的扫描,然而真正去修改infer配置的时候,发现相关资料很少,去官网页是查了好久才有所发现,在此记录希望可以帮到其他朋友:

感谢@akotulski的详细说明

How to include project folders or exclude dependency folders during analysis of iOS project? I
Yes, there is a way to exclude certain directories. I'll illustrate it by example let me know if it works for you.
If your use case is different/more complex let me know as well.

Let's say I have a project with following directory structure.


  -  // libraries that your project depends on.
    -  // you want to skip analyzing those
    -  // you want to analyze those
  -  // implementation of your project 
  -  // headers of your project
  -  // irrelevant
We have a way of providing extra information to guide the analyzer by .inferconfig file (it's in json format)

Step 1:
Create .inferconfig file (name is important) in  directory

Step 2:
Add entry for skip-clang-analysis-in-path with list of all paths relative to .
.inferconfig file should look like this:

{
    "skip-clang-analysis-in-path": [
        "Lib/ExternalDeps"
    ]
}
Step 3:
Run infer from  directory (it's important for infer to find .inferconfig file there). If you have to run infer from different directory, you have pass --project-root flag to your infer invocation. And that's all.

你可能感兴趣的:(Facebook Infer 过滤第三方)