tests/tools/check_source.sh
changeset 2433 2e8bf28a8909
parent 2432 dbc065a2f7a5
child 2434 07f48018b6f5
equal deleted inserted replaced
2432:dbc065a2f7a5 2433:2e8bf28a8909
    27 set_exit_error()
    27 set_exit_error()
    28 {
    28 {
    29     if [ $exit_code -eq 0 ]; then
    29     if [ $exit_code -eq 0 ]; then
    30        exit_code=1
    30        exit_code=1
    31     fi
    31     fi
       
    32 }
       
    33 
       
    34 version_gt()
       
    35 {
       
    36     test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1";
    32 }
    37 }
    33 
    38 
    34 
    39 
    35 compile_checks()
    40 compile_checks()
    36 {
    41 {
   235     echo "DONE"
   240     echo "DONE"
   236     echo ""
   241     echo ""
   237 }
   242 }
   238 
   243 
   239 pylint_checks()
   244 pylint_checks()
       
   245 
   240 {
   246 {
   241     echo "Check for problems using pylint ..."
   247     echo "Check for problems using pylint ..."
   242 
   248 
   243     which pylint > /dev/null
   249     which pylint > /dev/null
   244     if [ $? -ne 0 ]; then
   250     if [ $? -ne 0 ]; then
   352     enable=$enable,W1648          # (bad-python3-import) Module moved in Python 3
   358     enable=$enable,W1648          # (bad-python3-import) Module moved in Python 3
   353     enable=$enable,W1613          # (xrange-builtin) xrange built-in referenced
   359     enable=$enable,W1613          # (xrange-builtin) xrange built-in referenced
   354     # enable=
   360     # enable=
   355 
   361 
   356     options=
   362     options=
       
   363 
       
   364     ver=$(pylint --version 2>&1 | grep pylint  | awk '{ print $2 }')
       
   365     if version_gt $ver '1.6.8'; then
       
   366 	echo "Use multiple threads for pylint"
       
   367 	options="$options --jobs=0 "
       
   368     fi
   357     options="$options --rcfile=.pylint"
   369     options="$options --rcfile=.pylint"
   358     # options="$options --py3k"   # report errors for Python 3 porting
   370     # options="$options --py3k"   # report errors for Python 3 porting
   359 
   371 
   360     if [ -n "$enable" ]; then
   372     if [ -n "$enable" ]; then
   361         options="$options --disable=all"
   373         options="$options --disable=all"