James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | set -ev |
| 3 | |
| 4 | # |
James E. King, III | 350fe75 | 2017-10-25 09:57:18 -0400 | [diff] [blame] | 5 | # Generate thrift files so the static code analysis includes an analysis |
| 6 | # of the files the thrift compiler spits out. If running interactively |
| 7 | # set the NOBUILD environment variable to skip the boot/config/make phase. |
| 8 | # |
| 9 | |
| 10 | if [[ -z "$NOBUILD" ]]; then |
| 11 | ./bootstrap.sh |
| 12 | ./configure --enable-tutorial=no |
| 13 | make -j3 precross |
| 14 | fi |
| 15 | |
| 16 | # |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 17 | # C/C++ static code analysis with cppcheck |
| 18 | # add --error-exitcode=1 to --enable=all as soon as everything is fixed |
| 19 | # |
| 20 | # Python code style check with flake8 |
| 21 | # |
| 22 | # search for TODO etc within source tree |
| 23 | # some statistics about the code base |
| 24 | # some info about the build machine |
| 25 | |
| 26 | # Compiler cppcheck (All) |
| 27 | cppcheck --force --quiet --inline-suppr --enable=all -j2 compiler/cpp/src |
| 28 | |
| 29 | # C++ cppcheck (All) |
| 30 | cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp |
| 31 | |
| 32 | # C Glib cppcheck (All) |
| 33 | cppcheck --force --quiet --inline-suppr --enable=all -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib |
| 34 | |
| 35 | # Silent error checks |
James E. King, III | 350fe75 | 2017-10-25 09:57:18 -0400 | [diff] [blame] | 36 | # See THRIFT-4371 : flex generated code triggers "possible null pointer dereference" in yy_init_buffer |
| 37 | cppcheck --force --quiet --inline-suppr --suppress="*:thrift/thriftl.cc" --error-exitcode=1 -j2 compiler/cpp/src |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 38 | cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/cpp/test test/cpp tutorial/cpp |
| 39 | cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib |
| 40 | |
| 41 | # Python code style |
| 42 | flake8 --ignore=E501 lib/py |
| 43 | flake8 tutorial/py |
James E. King, III | 350fe75 | 2017-10-25 09:57:18 -0400 | [diff] [blame] | 44 | # THRIFT-4371 : generated files are excluded because they haven't been scrubbed yet |
| 45 | flake8 --ignore=E501 --exclude="*/gen-py*/*" test/py |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 46 | flake8 test/py.twisted |
| 47 | flake8 test/py.tornado |
| 48 | flake8 --ignore=E501 test/test.py |
James E. King, III | 350fe75 | 2017-10-25 09:57:18 -0400 | [diff] [blame] | 49 | flake8 --ignore=E501,E722 test/crossrunner |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 50 | flake8 test/features |
| 51 | |
Robert Lu | b03ca01 | 2018-01-18 19:06:39 +0800 | [diff] [blame^] | 52 | # PHP code style |
| 53 | composer install --quiet |
| 54 | ./vendor/bin/phpcs |
| 55 | |
James E. King, III | 0ad20bd | 2017-09-30 15:44:16 -0700 | [diff] [blame] | 56 | # TODO etc |
| 57 | echo FIXMEs: `grep -r FIXME * | wc -l` |
| 58 | echo HACKs: `grep -r HACK * | wc -l` |
| 59 | echo TODOs: `grep -r TODO * | wc -l` |
| 60 | |
| 61 | # LoC |
| 62 | sloccount . |
| 63 | |
| 64 | # System Info |
| 65 | dpkg -l |
| 66 | uname -a |