Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C static analysis tools -- plugin to Xcode?

Are there any tools out there for Objective-C / Xcode? Something that can do one or more of the following:

  • Detect unused imports
  • Auto-synthesize properties
  • Autogenerate dealloc method from retained properties
  • Provide method stubs for interface
like image 205
DevDevDev Avatar asked Apr 15 '10 20:04

DevDevDev


People also ask

How do I run static analyzer in Xcode?

It's very easy to run. Just go to Product and choose Analyze, or use the keyboard shortcut Command-Shift-B. You can see the analyzer running in the status bar of Xcode.

What is Clang sa?

The Clang Static Analyzer is a source code analysis tool that finds bugs in C, C++, and Objective-C programs. Currently it can be run either from the command line or if you use macOS then within Xcode.

What is static analysis tool?

Static analysis tools refer to a wide array of tools that examine source code, executables, or even documentation, to find problems before they happen; without actually running the code.


2 Answers

-Detect unused imports

Not sure of anything that checks for dead imports.

-Auto-synthesize properties -Autogenerate dealloc method from retained properties

User Scripts work quite well to do this inside Xcode, you can also use a program like Acessorizer as mentioned but it pastes something onto the clipboard for you to paste.

-Provide method stubs for interface

type "init" just after @implementation, and type Control-. (period).

These are user macros (not scripts), and you can easily define your own. Note they have placeholders that you can use tab to jump to the bits to fill in.

like image 75
Kendall Helmstetter Gelner Avatar answered Sep 20 '22 19:09

Kendall Helmstetter Gelner


You want to look at Kevin Callahan's Accessorizer, which can do several of the things you request and more. The Google Toolbox for Mac also includes an Xcode plugin that can remove whitespace and a few other things.

like image 30
Felixyz Avatar answered Sep 19 '22 19:09

Felixyz