cpplint.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. export LOGFILE=cpplint.log
  3. source ./tools/ci/scripts/init.sh
  4. rm cpplint.py
  5. tools/ci/scripts/retry.sh wget "https://raw.githubusercontent.com/google/styleguide/gh-pages/cpplint/cpplint.py"
  6. chmod +x cpplint.py
  7. CHECKER="./cpplint.py --filter=\
  8. -build/include,\
  9. -whitespace/braces,-whitespace/operators,-runtime/references,\
  10. -runtime/threadsafe_fn,-readability/streams,\
  11. -runtime/rtti,\
  12. -whitespace/newline,-whitespace/labels,\
  13. -runtime/indentation_namespace,\
  14. -whitespace/indent,\
  15. -whitespace/parens,\
  16. -runtime/int,\
  17. -readability/todo,\
  18. -runtime/arrays,\
  19. -runtime/printf,\
  20. -whitespace/empty_loop_body,\
  21. -build/c++11,\
  22. -readability/fn_size,\
  23. -build/header_guard,\
  24. -readability/braces,\
  25. -legal/copyright,\
  26. -whitespace/semicolon,\
  27. -readability/namespace,\
  28. -readability/casting,\
  29. -readability/inheritance,\
  30. -runtime/string,\
  31. -build/c++tr1"
  32. find src -type f -name "*.cpp" -exec $CHECKER {} \; 2>${ERRFILE}2
  33. find src -type f -name "*.hpp" -exec $CHECKER {} \; 2>>${ERRFILE}2
  34. find src -type f -name "*.h" -exec $CHECKER {} \; 2>>${ERRFILE}2
  35. find src -type f -name "*.cc" -exec $CHECKER {} \; 2>>${ERRFILE}2
  36. grep ": " ${ERRFILE}2 | \
  37. grep -v "src/debug/" | \
  38. grep -v "unittests/doctest.h" | \
  39. grep -v "unittests/catch.hpp" | \
  40. grep -v "debug/fast_mutex" | \
  41. grep -v "sdl2gfx/SDL2" \
  42. >${ERRFILE}
  43. rm ${ERRFILE}2
  44. run_check_warnings
  45. echo ok