|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# One grep to rule them all. |
| 4 | +# One grep to find them. |
| 5 | +# One grep to bring them all, |
| 6 | +# and figure out why shit is fucked. |
| 7 | + |
| 8 | +if [ -t 1 ]; then |
| 9 | + color="always" |
| 10 | +else |
| 11 | + color="never" |
| 12 | +fi |
| 13 | + |
| 14 | +exclusions=( |
| 15 | + # Exclude minified directories. |
| 16 | + --exclude-dir='minified' |
| 17 | + --exclude-dir='combined' |
| 18 | + # Exclude minified JS files. |
| 19 | + --exclude='*.*.js' |
| 20 | + --exclude='*combined*.js' |
| 21 | + # Exclude JS files we probably do not care about. |
| 22 | + --exclude='*jquery*.js' |
| 23 | + --exclude='*bootstrap*.js' |
| 24 | + --exclude='jstz.js' |
| 25 | + --exclude-dir='bootstrap' |
| 26 | + --exclude-dir='bootstrap-*-*-*' |
| 27 | + --exclude-dir='font-awesome' |
| 28 | + --exclude-dir='ckeditor' |
| 29 | + --exclude='knockout.js' |
| 30 | + --exclude='underscore.js' |
| 31 | + --exclude='highcharts.js' |
| 32 | + --exclude='analytics.js' |
| 33 | + --exclude-dir='select2' |
| 34 | + --exclude='es5.js' |
| 35 | + # Exclude minified CSS files. |
| 36 | + --exclude='*.*.css' |
| 37 | + --exclude='*combined*.css' |
| 38 | + # Exclude plaintext files. |
| 39 | + --exclude='*.txt' |
| 40 | + --exclude='*.xml' |
| 41 | + --exclude='*.md' |
| 42 | + --exclude='*.rst' |
| 43 | + --exclude='*.svg' |
| 44 | + --exclude='*.po' |
| 45 | + --exclude='*license*' |
| 46 | + --exclude='README*' |
| 47 | + --exclude='readme*' |
| 48 | + --exclude='VERSION*' |
| 49 | + --exclude='INSTALL*' |
| 50 | + --exclude='LICENSE*' |
| 51 | + --exclude='CREDITS*' |
| 52 | + --exclude='COPYING*' |
| 53 | + --exclude='MAINTAINERS*' |
| 54 | + --exclude='RELEASE*' |
| 55 | + --exclude='Changelog' |
| 56 | + --exclude-dir='documentation' |
| 57 | + --exclude-dir='docs' |
| 58 | + --exclude='*.types' |
| 59 | + # SSH files |
| 60 | + --exclude='*.cert' |
| 61 | + --exclude='*.crt' |
| 62 | + --exclude='*.key' |
| 63 | + --exclude='*.pem' |
| 64 | + --exclude='*.pub' |
| 65 | + # Exclude build files |
| 66 | + --exclude-dir='bin' |
| 67 | + --exclude='Makefile' |
| 68 | + --exclude='configure' |
| 69 | + --exclude='*.mak' |
| 70 | + --exclude='*.ini' |
| 71 | + --exclude='*.cmd' |
| 72 | + --exclude='*.bat' |
| 73 | + --exclude='build.sh' |
| 74 | + --exclude='travis-ci.sh' |
| 75 | + --exclude='*.apib' |
| 76 | + --exclude='*.pp' |
| 77 | + --exclude='*.pip' |
| 78 | + --exclude='run-*.sh' |
| 79 | + # Qt generated CPP files. |
| 80 | + --exclude='moc_*.cpp' |
| 81 | + # Exclude special source control directories. |
| 82 | + --exclude-dir='.git' |
| 83 | + --exclude-dir='.svn' |
| 84 | + # Exclude common virtualenv names. |
| 85 | + --exclude-dir='env' |
| 86 | + --exclude-dir='ve' |
| 87 | + # Exclude Django migration files. |
| 88 | + --exclude='0*.py' |
| 89 | + # Exclude Python settings files. |
| 90 | + --exclude='*settings*.py' |
| 91 | + # Exclude common configuration files. |
| 92 | + --exclude='*.jshintrc' |
| 93 | + --exclude='*.cfg' |
| 94 | + --exclude='.*project' |
| 95 | + --exclude='*.pro' |
| 96 | + --exclude='.gitattributes' |
| 97 | + --exclude='.gitignore' |
| 98 | + --exclude='.editorconfig' |
| 99 | + --exclude='.directory' |
| 100 | + --exclude='.travis.yml' |
| 101 | + # DUB files. |
| 102 | + --exclude='package.json' |
| 103 | + --exclude='dub.json' |
| 104 | + --exclude='dub.selections.json' |
| 105 | + # Exclude sockets |
| 106 | + --exclude='*.sock' |
| 107 | + # Exclude backup files |
| 108 | + --exclude='*.bak' |
| 109 | + --exclude='*.orig' |
| 110 | +) |
| 111 | + |
| 112 | +grep -PrI --color="$color" "${exclusions[@]}" "$@" |
0 commit comments