Created
April 22, 2015 13:49
-
-
Save pascaldevink/b86fd10302fc86d0e899 to your computer and use it in GitHub Desktop.
Find the cyclomatic complexity of the most changed PHP files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git log --pretty=format: --name-only | sort | uniq -c | grep .php | sort -rg | head -100 | awk -F ' ' '{print $2}' | xargs -I input phpmd input text codesize | grep class | grep complexity | awk -F " " '{print $1 " " $10}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Will print the cyclomatic complexity of the 100 most changed files, like so:
The first part of the script is useful if you want to know exactly how many changes a file has had:
git log --pretty=format: --name-only | sort | uniq -c | grep .php | sort -rg | head -100
This will output something like:
250 /application/modules/Default/Controller/XXX.php
184 /application/modules/Default/Controller/YYY.php
102 /application/modules/Default/Controller/Foo.php