Last active
August 29, 2015 14:07
-
-
Save sergeant-wizard/c4ebd58194bcc7fd804c to your computer and use it in GitHub Desktop.
cpplint cleaner
This file contains 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
*.cpp filter=cpplint_cleaner | |
*.h filter=cpplint_cleaner |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
#!/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" \ |
This file contains 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
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 |
This file contains 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
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