Вопрос

What tool can I use to test McCabe-style function complexity of my code on Max OS X?

There is pmccabe for Linux, which is on my department's machines and what they want me to use. It analyzes each function in certain project files and spews out data for each, including function complexity as a McCabe-style integer (example output). I'd love something that has the same functionality.

Это было полезно?

Решение 2

It took a while to find this:

Use homebrew.

Copy this line into a Terminal to install homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Then, run this command:

$ brew install pmccabe

Другие советы

Running a virtual machine on your Mac is free if you need access to pmccabe or other linux only tools such as valgrind.

You can download virtual box from https://www.virtualbox.org/

Here are some ubuntu images that came up from a quick google search: http://virtualboxes.org/images/ubuntu/

You might also look into ssh'ing into the university computers. Good luck!

pmccabe is available for Mac OS X. It can be installed using Homebrew.

The link provided in the accepted answer is now outdated. Try entering the following in Terminal to install Homebrew:

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then enter the following command to install pmccabe:

$ brew install pmccabe

Once installed, use pmccabe as you would normally. The following will output a complexity test for all .h and .cpp files in the current directory:

$ pmccabe *.h *.cpp
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top