Skip to content

Instantly share code, notes, and snippets.

@sergeant-wizard
Last active August 29, 2015 14:07
Show Gist options
  • Save sergeant-wizard/c4ebd58194bcc7fd804c to your computer and use it in GitHub Desktop.
Save sergeant-wizard/c4ebd58194bcc7fd804c to your computer and use it in GitHub Desktop.
cpplint cleaner
*.cpp filter=cpplint_cleaner
*.h filter=cpplint_cleaner
if (true) {
}
if (true) {
a, b
a, b
for (;;) {
}
for (;;) {
}
} else {
} else {
std::vector<std::function<std::pair<int, double>(char)>>
a + b
a + b
a + b
a + b
a - b
a - b
a - b
a - b
a / b
a / b
a / b
a / b
a = b
a = b
a = b
a = b
if(true){
}
if (true) {
a,b
a, b
for(;;){
}
for (;;) {
}
}else{
} else {
std::vector<std::function<std::pair<int,double>(char)>>
a+b
a +b
a+ b
a + b
a-b
a -b
a- b
a - b
a/b
a /b
a/ b
a / b
a=b
a =b
a= b
a = b
#!/bin/bash
sed \
-e "s/){/) {/g" \
-e "s/if(/if (/g" \
-e "s/for(/for (/g" \
-e "s/ \{1,\}$//" \
-e "s/else{/else {/" \
-e "s/}else/} else/" \
-e "s/,\([^ ]\)/, \1/g" \
-e "s/\([+=/-]\)\([^ ]\)/\1 \2/g" \
-e "s/\([^ ]\)\([+=/-]\)/\1 \2/g" \
bash cleaner.sh spec/before.cpp > out.txt
diff out.txt spec/after.cpp
if [ $? == 0 ]; then
echo "test succeeded"
else
echo "test failed"
fi
rm out.txt
echo "[filter \"cpplint_cleaner\"]" >> .git/config
echo " clean = bash scripts/cleaner/cleaner.sh" >> .git/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment