FaceBook/infer-linter静态代码分析

Linter 分析,揪出因语法错误、打字错误或数据类型错误而引起的bug源头.Infer也支持这样简单的分析,只需要加一个参数-a checkers就可以

命令

infer -a checkers -i -- xcodebuild -target HelloWorldApp -configuration Debug -sdk iphonesimulator

我们对iOS相对进行linter检查

58deMacBook-Pro:ios_hello wuxian$ infer -a checkers -i -- xcodebuild -target HelloWorldApp -configuration Debug -sdk iphonesimulator
Build settings from command line:
    CC = /Users/wuxian/Downloads/infer-osx-v0.1.0/infer/infer/bin/../lib/capture/clang
    CPLUSPLUS = /Users/wuxian/Downloads/infer-osx-v0.1.0/infer/infer/bin/../lib/capture/clang++
    DEBUG_INFORMATION_FORMAT = 'dwarf'
    LD = /usr/bin/true
    LDPLUSPLUS = /usr/bin/true
    LIPO = /usr/bin/true
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET HelloWorldApp OF PROJECT HelloWorldApp WITH CONFIGURATION Debug ===

Check dependencies

** BUILD SUCCEEDED **

Starting analysis (Infer version v0.1.0)
Analysis done

4 files analyzed


/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/main.m:13: error: CHECKERS_DEAD_CODE
  Node not visited: 209

58deMacBook-Pro:ios_hello wuxian$ infer -a checkers -i -- xcodebuild -target HelloWorldApp -configuration Debug -sdk iphonesimulator
Build settings from command line:
    CC = /Users/wuxian/Downloads/infer-osx-v0.1.0/infer/infer/bin/../lib/capture/clang
    CPLUSPLUS = /Users/wuxian/Downloads/infer-osx-v0.1.0/infer/infer/bin/../lib/capture/clang++
    DEBUG_INFORMATION_FORMAT = 'dwarf'
    LD = /usr/bin/true
    LDPLUSPLUS = /usr/bin/true
    LIPO = /usr/bin/true
    SDKROOT = iphonesimulator8.2

=== BUILD TARGET HelloWorldApp OF PROJECT HelloWorldApp WITH CONFIGURATION Debug ===

Check dependencies

** BUILD SUCCEEDED **

Starting analysis (Infer version v0.1.0)
Analysis done

4 files analyzed


/Users/wuxian/Downloads/infer-osx-v0.1.0/infer/examples/ios_hello/HelloWorldApp/main.m:13: error: CHECKERS_DEAD_CODE
  Node not visited: 209

58deMacBook-Pro:ios_hello wuxian$

明显提示出来的问题和之前是有区别的.

你可能感兴趣的:(FaceBook/infer-linter静态代码分析)