Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Analyzer - Ignore CocoaPods targets

I have an Xcode workspace set up with CocoaPods. When I run Xcode's Analyzer on my project it analyzes my own source code as well as all the source code in the Pods targets. This throws up lots of warnings that I am not interested in as I only want to see the analyzer warnings of my own source code.

I have unchecked "Analyze" from the build target for pods but this doesn't seem to have any effect.

Is there a way to ignore Pods targets when running the analyzer?

enter image description here

like image 231
Brian Boyle Avatar asked Oct 02 '14 16:10

Brian Boyle


1 Answers

Here's an update/modification for the existing answer:

With Cocoapods 0.38+ installer attribute needed to get the project has changed such that you need to use "pods_project" instead of "project" like so:

post_install do |installer|
    puts 'Removing static analyzer support'
    installer.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['OTHER_CFLAGS'] = "$(inherited) -Qunused-arguments -Xanalyzer -analyzer-disable-all-checks"
        end
    end
end

See the following Cocoapods blog announcement for more details on the change: http://blog.cocoapods.org/CocoaPods-0.38/#breaking-change-to-the-hooks-api

Also, here's a (closed) issue showing the error you would receive if you tried the old way with the new code: https://github.com/CocoaPods/CocoaPods/issues/3918

like image 136
philarmour Avatar answered Oct 21 '22 06:10

philarmour