tests/tools/check_source.sh
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Fri, 25 May 2018 17:23:15 +0300
changeset 2166 5ce6d08ff2c7
parent 2016 2a8cd24a14ca
child 2181 52630996e51b
permissions -rwxr-xr-x
make clipboard open minimal time as wxPython documentation recommends

https://wxpython.org/Phoenix/docs/html/wx.Clipboard.html#wx.Clipboard.GetData

"Call wx.Clipboard.Open to get ownership of the clipboard. If this
operation returns True, you now own the clipboard. Call
wx.Clipboard.SetData to put data on the clipboard, or
wx.Clipboard.GetData to retrieve data from the clipboard. Call
wx.Clipboard.Close to close the clipboard and relinquish ownership.
You should keep the clipboard open only momentarily."

Maybe it makes situation with pretty annoying error 'clipboard already
open' a little bit better.

traceback:
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 955, in OnSaveProjectMenu
self.RefreshAfterSave()
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 946, in RefreshAfterSave
self._Refresh(TITLE, FILEMENU, EDITMENU, PAGETITLES)
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 926, in _Refresh
self.RefreshFunctions[element]()
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/BeremizIDE.py", line 766, in RefreshEditMenu
IDEFrame.RefreshEditMenu(self)
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 1185, in RefreshEditMenu
if self.GetCopyBuffer() is not None:
File "/home/developer/WorkData/PLC/beremiz/avangard-beremiz-ide/src/../../beremiz/IDEFrame.py", line 956, in GetCopyBuffer
if wx.TheClipboard.Open():
File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_misc.py", line 5793, in Open
return _misc_.Clipboard_Open(*args, **kwargs)
<class 'wx._core.PyAssertionError'>: C++ assertion "!m_open" failed at ../src/gtk/clipbrd.cpp(598) in Open(): clipboard already open
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     2
# -*- coding: utf-8 -*-
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     3
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     4
# This file is part of Beremiz, a Integrated Development Environment for
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     5
# programming IEC 61131-3 automates supporting plcopen standard and CanFestival.
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     6
#
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     7
# Copyright (C) 2017: Andrey Skvortsov
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     8
#
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
     9
# See COPYING file for copyrights details.
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    10
#
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    11
# This program is free software; you can redistribute it and/or
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    12
# modify it under the terms of the GNU General Public License
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    13
# as published by the Free Software Foundation; either version 2
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    14
# of the License, or (at your option) any later version.
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    15
#
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    16
# This program is distributed in the hope that it will be useful,
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    19
# GNU General Public License for more details.
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    20
#
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    21
# You should have received a copy of the GNU General Public License
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    22
# along with this program; if not, write to the Free Software
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    23
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    24
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    25
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    26
exit_code=0
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    27
set_exit_error()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    28
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    29
    if [ $exit_code -eq 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    30
       exit_code=1
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    31
    fi
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    32
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    33
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    34
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    35
compile_checks()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    36
{
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    37
    echo "Syntax checking using python ..."
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    38
    py_files=$(find . -name '*.py')
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    39
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    40
    python --version
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    41
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    42
    # remove compiled Python files
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    43
    find . -name '*.pyc' -exec rm -f {} \;
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    44
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    45
    for i in $py_files; do
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    46
        # echo $i
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    47
        python -m py_compile $i
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    48
        if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    49
            echo "Syntax error in $i"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    50
            set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    51
        fi
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    52
    done
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    53
    echo "DONE"
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    54
    echo ""
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    55
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    56
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    57
# pep8 was renamed to pycodestyle
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    58
# detect existed version
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    59
pep8_detect()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    60
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    61
    test -n $pep8 && (which pep8 > /dev/null) && pep8="pep8"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    62
    test -n $pep8 && (which pycodestyle > /dev/null) && pep8="pycodestyle"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    63
    if [ -z $pep8 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    64
        echo "pep8/pycodestyle is not found"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    65
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    66
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    67
    echo -n "pep8 version: "
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
    68
    $pep8 --version
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    69
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    70
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    71
pep8_checks_default()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    72
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    73
    echo "Check basic code-style problems for PEP-8"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    74
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    75
    test -n $pep8 && pep8_detect
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    76
    test -z $pep8 && return
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    77
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    78
    user_ignore=
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    79
    # user_ignore=$user_ignore,E265  # E265 block comment should start with '# '
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    80
    user_ignore=$user_ignore,E501  # E501 line too long (80 > 79 characters)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    81
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    82
    # ignored by default,
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    83
    default_ignore=
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    84
    default_ignore=$default_ignore,E121  # E121 continuation line under-indented for hanging indent
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    85
    default_ignore=$default_ignore,E123  # E123 closing bracket does not match indentation of opening bracket’s line
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    86
    default_ignore=$default_ignore,E126  # E126 continuation line over-indented for hanging indent
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    87
    default_ignore=$default_ignore,E133  # E133 closing bracket is missing indentation
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    88
    default_ignore=$default_ignore,E226  # E226 missing whitespace around arithmetic operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    89
    default_ignore=$default_ignore,E241  # E241 multiple spaces after ':'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    90
    default_ignore=$default_ignore,E242  # E242 tab after ‘,’
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    91
    default_ignore=$default_ignore,E704  # E704 multiple statements on one line (def)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    92
    default_ignore=$default_ignore,W503  # W503 line break occurred before a binary operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    93
    ignore=$user_ignore,$default_ignore
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    94
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    95
    # $pep8 --ignore $ignore --exclude build ./
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    96
    $pep8 --max-line-length 300 --exclude build ./
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    97
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    98
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
    99
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   100
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   101
    echo "DONE"
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   102
    echo ""
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   103
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   104
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   105
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   106
pep8_checks_selected()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   107
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   108
    echo "Check basic code-style problems for PEP-8 (selective)"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   109
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   110
    test -n $pep8 && pep8_detect
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   111
    test -z $pep8 && return
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   112
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   113
    # select checks:
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   114
    user_select=
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   115
    user_select=$user_select,W291   # W291 trailing whitespace
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   116
    user_select=$user_select,E401   # E401 multiple imports on one line
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   117
    user_select=$user_select,E265   # E265 block comment should start with '# '
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   118
    user_select=$user_select,E228   # E228 missing whitespace around modulo operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   119
    user_select=$user_select,W293   # W293 blank line contains whitespace
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   120
    user_select=$user_select,E302   # E302 expected 2 blank lines, found 1
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   121
    user_select=$user_select,E261   # E261 at least two spaces before inline comment
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   122
    user_select=$user_select,E271   # E271 multiple spaces after keyword
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   123
    user_select=$user_select,E231   # E231 missing whitespace after ','
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   124
    user_select=$user_select,E303   # E303 too many blank lines (2)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   125
    user_select=$user_select,E225   # E225 missing whitespace around operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   126
    user_select=$user_select,E711   # E711 comparison to None should be 'if cond is not None:'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   127
    user_select=$user_select,E251   # E251 unexpected spaces around keyword / parameter equals
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   128
    user_select=$user_select,E227   # E227 missing whitespace around bitwise or shift operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   129
    user_select=$user_select,E202   # E202 whitespace before ')'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   130
    user_select=$user_select,E201   # E201 whitespace after '{'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   131
    user_select=$user_select,W391   # W391 blank line at end of file
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   132
    user_select=$user_select,E305   # E305 expected 2 blank lines after class or function definition, found X
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   133
    user_select=$user_select,E306   # E306 expected 1 blank line before a nested definition, found X
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   134
    user_select=$user_select,E703   # E703 statement ends with a semicolon
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   135
    user_select=$user_select,E701   # E701 multiple statements on one line (colon)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   136
    user_select=$user_select,E221   # E221 multiple spaces before operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   137
    user_select=$user_select,E741   # E741 ambiguous variable name 'l'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   138
    user_select=$user_select,E111   # E111 indentation is not a multiple of four
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   139
    user_select=$user_select,E222   # E222 multiple spaces after operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   140
    user_select=$user_select,E712   # E712 comparison to True should be 'if cond is True:' or 'if cond:'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   141
    user_select=$user_select,E262   # E262 inline comment should start with '# '
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   142
    user_select=$user_select,E203   # E203 whitespace before ','
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   143
    user_select=$user_select,E731   # E731 do not assign a lambda expression, use a def
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   144
    user_select=$user_select,W601   # W601 .has_key() is deprecated, use 'in'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   145
    user_select=$user_select,E502   # E502 the backslash is redundant between brackets
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   146
    user_select=$user_select,W602   # W602 deprecated form of raising exception
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   147
    user_select=$user_select,E129   # E129 visually indented line with same indent as next logical line
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   148
    user_select=$user_select,E127   # E127 continuation line over-indented for visual indent
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   149
    user_select=$user_select,E128   # E128 continuation line under-indented for visual indent
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   150
    user_select=$user_select,E125   # E125 continuation line with same indent as next logical line
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   151
    user_select=$user_select,E114   # E114 indentation is not a multiple of four (comment)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   152
    user_select=$user_select,E211   # E211 whitespace before '['
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   153
    user_select=$user_select,W191   # W191 indentation contains tabs
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   154
    user_select=$user_select,E101   # E101 indentation contains mixed spaces and tabs
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   155
    user_select=$user_select,E124   # E124 closing bracket does not match visual indentation
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   156
    user_select=$user_select,E272   # E272 multiple spaces before keyword
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   157
    user_select=$user_select,E713   # E713 test for membership should be 'not in'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   158
    user_select=$user_select,E122   # E122 continuation line missing indentation or outdented
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   159
    user_select=$user_select,E131   # E131 continuation line unaligned for hanging indent
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   160
    user_select=$user_select,E721   # E721 do not compare types, use 'isinstance()'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   161
    user_select=$user_select,E115   # E115 expected an indented block (comment)
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   162
    user_select=$user_select,E722   # E722 do not use bare except'
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   163
    user_select=$user_select,E266   # E266 too many leading '#' for block comment
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   164
    user_select=$user_select,E402   # E402 module level import not at top of file
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   165
    user_select=$user_select,W503   # W503 line break before binary operator
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   166
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   167
    $pep8 --select $user_select --exclude=build .
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   168
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   169
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   170
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   171
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   172
    echo "DONE"
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   173
    echo ""
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   174
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   175
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   176
flake8_checks()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   177
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   178
    echo "Check for problems using flake8 ..."
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   179
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   180
    which flake8 > /dev/null
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   181
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   182
        echo "flake8 is not found"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   183
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   184
        return
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   185
    fi
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   186
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   187
    echo -n "flake8 version: "
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   188
    flake8 --version
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   189
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   190
    flake8 --max-line-length=300  --exclude=build --builtins="_" ./
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   191
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   192
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   193
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   194
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   195
    echo "DONE"
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   196
    echo ""
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   197
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   198
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   199
pylint_checks()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   200
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   201
    echo "Check for problems using pylint ..."
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   202
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   203
    which pylint > /dev/null
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   204
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   205
        echo "pylint is not found"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   206
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   207
        return
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   208
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   209
    pylint --version
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   210
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   211
    export PYTHONPATH="$PWD/../CanFestival-3/objdictgen":$PYTHONPATH
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   212
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   213
    disable=
1854
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   214
    # These warnings most likely will not be fixed
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   215
1833
2269739dd098 fix unnecessary lambda and enable corresponding pylint check
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1832
diff changeset
   216
    disable=$disable,C0103        # invalid-name
2269739dd098 fix unnecessary lambda and enable corresponding pylint check
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1832
diff changeset
   217
    disable=$disable,C0326        # bad whitespace
2269739dd098 fix unnecessary lambda and enable corresponding pylint check
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1832
diff changeset
   218
    disable=$disable,W0110        # (deprecated-lambda) map/filter on lambda could be replaced by comprehension
1846
14b40afccd69 remove unused variables found by pylint
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1841
diff changeset
   219
    disable=$disable,W1401        # (anomalous-backslash-in-string) Anomalous backslash in string: '\.'. String constant might be missing an r prefix.
1851
1b8b5324506c fix pylint warning '(old-style-class) Old-style class defined.'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1850
diff changeset
   220
    disable=$disable,W0613        # (unused-argument) Unused argument 'X'
1b8b5324506c fix pylint warning '(old-style-class) Old-style class defined.'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1850
diff changeset
   221
    disable=$disable,W0622        # (redefined-builtin) Redefining built-in
1854
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   222
    disable=$disable,W0621        # (redefined-outer-name) Redefining name 'Y' from outer scope (line X)    
1855
f33942053466 fix pylint warning "(undefined-loop-variable) Using possibly undefined loop variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1854
diff changeset
   223
    disable=$disable,W0122        # (exec-used) Use of exec
f33942053466 fix pylint warning "(undefined-loop-variable) Using possibly undefined loop variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1854
diff changeset
   224
    disable=$disable,W0123        # (eval-used) Use of eval
1873
e69d7e5aff00 fix pylint warning '(no-init) Class has no __init__ method'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1872
diff changeset
   225
    disable=$disable,I0011        # (locally-disabled) Locally disabling ungrouped-imports (C0412)
1876
995df4804221 fix pylint warning '(expression-not-assigned) Expression "X" is assigned to nothing'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1875
diff changeset
   226
    disable=$disable,R0204        # (redefined-variable-type) Redefinition of current type from X to Y
1878
fb73a6b6622d fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1876
diff changeset
   227
    disable=$disable,R0201        # (no-self-use) Method could be a function
1879
4d81c3bcac82 fix pylint error '(unsubscriptable-object) Value 'X' is unsubscriptable'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1878
diff changeset
   228
    disable=$disable,W0221        # (arguments-differ) Arguments number differs from overridden 'X' method
4d81c3bcac82 fix pylint error '(unsubscriptable-object) Value 'X' is unsubscriptable'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1878
diff changeset
   229
    disable=$disable,C0201        # (consider-iterating-dictionary) Consider iterating the dictionary directly instead of calling .keys()
1854
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   230
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   231
    # It'd be nice to fix warnings below some day
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   232
    disable=$disable,C0111        # missing-docstring
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   233
    disable=$disable,W0703        # broad-except
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   234
    disable=$disable,C0301        # Line too long
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   235
    disable=$disable,C0302        # Too many lines in module
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   236
    disable=$disable,W0511        # fixme    
1868
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   237
    disable=$disable,R0901        # (too-many-ancestors) Too many ancestors (9/7)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   238
    disable=$disable,R0902        # (too-many-instance-attributes) Too many instance attributes (10/7)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   239
    disable=$disable,R0903        # (too-few-public-methods) Too few public methods (0/2)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   240
    disable=$disable,R0904        # (too-many-public-methods) Too many public methods (41/20)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   241
    disable=$disable,R0911        # (too-many-return-statements) Too many return statements (7/6)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   242
    disable=$disable,R0912        # (too-many-branches) Too many branches (61/12)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   243
    disable=$disable,R0913        # (too-many-arguments) Too many arguments (6/5)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   244
    disable=$disable,R0914        # (too-many-locals) Too many local variables (18/15)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   245
    disable=$disable,R0915        # (too-many-statements) Too many statements (57/50)
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   246
    disable=$disable,R0916        # (too-many-boolean-expressions) Too many boolean expressions in if statement (6/5)
1872
866fb3ab8778 fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1870
diff changeset
   247
    disable=$disable,R0101        # (too-many-nested-blocks) Too many nested blocks (7/5)
1876
995df4804221 fix pylint warning '(expression-not-assigned) Expression "X" is assigned to nothing'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1875
diff changeset
   248
    disable=$disable,R0801        # (duplicate-code) Similar lines in N files
1872
866fb3ab8778 fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1870
diff changeset
   249
1879
4d81c3bcac82 fix pylint error '(unsubscriptable-object) Value 'X' is unsubscriptable'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1878
diff changeset
   250
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   251
    enable=
1831
56b48961cc68 fix (old-style-class) Old-style class defined error for most parts of
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1829
diff changeset
   252
    enable=$enable,E1601          # print statement used
56b48961cc68 fix (old-style-class) Old-style class defined error for most parts of
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1829
diff changeset
   253
    enable=$enable,C0325          # (superfluous-parens) Unnecessary parens after keyword    
1829
a776ac02b079 remove reimported modules
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1828
diff changeset
   254
    enable=$enable,W0404          # reimported module    
1834
cd42b426028b fix ungrouped imports from package X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1833
diff changeset
   255
    enable=$enable,C0411          # (wrong-import-order) standard import "import x" comes before "import y"
cd42b426028b fix ungrouped imports from package X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1833
diff changeset
   256
    enable=$enable,W0108          # (unnecessary-lambda) Lambda may not be necessary
cd42b426028b fix ungrouped imports from package X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1833
diff changeset
   257
    enable=$enable,C0412          # (ungrouped-imports) Imports from package X are not grouped
1835
7533061a6d82 fix more than one statement on a single line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1834
diff changeset
   258
    enable=$enable,C0321          # (multiple-statements) More than one statement on a single line
1836
d42b6cf00fa6 fix error __init__ method from base class is not called
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1835
diff changeset
   259
    enable=$enable,W0231          # (super-init-not-called) __init__ method from base class is not called
1837
c507c363625e fix pylint warning '(pointless-string-statement) String statement has no effect'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1836
diff changeset
   260
    enable=$enable,W0105          # (pointless-string-statement) String statement has no effect    
1838
646245c1c0d9 fix pylint warning (bad-indentation) Bad indentation. Found X spaces, expected Y
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1837
diff changeset
   261
    enable=$enable,W0311          # (bad-indentation) Bad indentation. Found 16 spaces, expected 12
1839
a2324624e516 fix pylint warning '(unreachable) Unreachable code'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1838
diff changeset
   262
    enable=$enable,W0101          # (unreachable) Unreachable code
1840
cf5ef4c0deff fix pylint error '(function-redefined) method already defined'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1839
diff changeset
   263
    enable=$enable,E0102          # (function-redefined) method already defined
1841
9fd29e8b1393 fix pylint warning '(global-variable-not-assigned) Using global for 'X' but no assignment is done'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1840
diff changeset
   264
    enable=$enable,W0602          # (global-variable-not-assigned) Using global for 'X' but no assignment is done
1846
14b40afccd69 remove unused variables found by pylint
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1841
diff changeset
   265
    enable=$enable,W0612          # (unused-variable) Unused variable 'X'
1851
1b8b5324506c fix pylint warning '(old-style-class) Old-style class defined.'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1850
diff changeset
   266
    enable=$enable,W0611          # (unused-import) Unused import X
1b8b5324506c fix pylint warning '(old-style-class) Old-style class defined.'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1850
diff changeset
   267
    enable=$enable,C1001          # (old-style-class) Old-style class defined. Problem with PyJS
1852
70c1cc354a8f fix pylint warning '(dangerous-default-value) Dangerous default value {} as argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1851
diff changeset
   268
    enable=$enable,W0102          # (dangerous-default-value) Dangerous default value {} as argument
1853
47a3f39bead0 fix pylint warning "(relative-import) Relative import 'Y', should be 'X.Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1852
diff changeset
   269
    enable=$enable,W0403          # (relative-import) Relative import 'Y', should be 'X.Y'
1854
cff5179cc601 fix pylint warning 'C0112(empty-docstring) Empty function docstring'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1853
diff changeset
   270
    enable=$enable,C0112          # (empty-docstring)
1855
f33942053466 fix pylint warning "(undefined-loop-variable) Using possibly undefined loop variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1854
diff changeset
   271
    enable=$enable,W0631          # (undefined-loop-variable) Using possibly undefined loop variable 'X'
1856
c2cba67145eb fix error found by pylint 'W0104(pointless-statement) Statement seems to have no effect'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1855
diff changeset
   272
    enable=$enable,W0104          # (pointless-statement) Statement seems to have no effect
1857
524ff4dbb7d9 remove old code useless code found by pylint "(unnecessary-pass) Unnecessary pass statement"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1856
diff changeset
   273
    enable=$enable,W0107          # (unnecessary-pass) Unnecessary pass statement
1858
4c5156dee87a fix pylint warning '(import-self) Module import itself'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1857
diff changeset
   274
    enable=$enable,W0406          # (import-self) Module import itself
1859
1df77c809257 fix pylint warning '(wrong-import-position) Import "import X" should be placed at the top of the module'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1858
diff changeset
   275
    enable=$enable,C0413          # (wrong-import-position) Import "import X" should be placed at the top of the module
1860
4eeddef7f973 fix format string argument error found by pylint '(too-many-format-args) Too many arguments for format string'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1859
diff changeset
   276
    enable=$enable,E1305          # (too-many-format-args) Too many arguments for format string
1861
410a3bcbeb29 fix pylint warning '(misplaced-bare-raise) The raise statement is not inside an except clause'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1860
diff changeset
   277
    enable=$enable,E0704          # (misplaced-bare-raise) The raise statement is not inside an except clause
1862
c4ba411f8c89 fix pylint warning '(unidiomatic-typecheck) Using type() instead of isinstance() for a typecheck'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1861
diff changeset
   278
    enable=$enable,C0123          # (unidiomatic-typecheck) Using type() instead of isinstance() for a typecheck.
1865
0bd5b3099144 fix pylint warning "(no-value-for-parameter) No value for argument 'X' in function call"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1863
diff changeset
   279
    enable=$enable,E0601          # (used-before-assignment) Using variable 'X' before assignment
0bd5b3099144 fix pylint warning "(no-value-for-parameter) No value for argument 'X' in function call"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1863
diff changeset
   280
    enable=$enable,E1120          # (no-value-for-parameter) No value for argument 'X' in function call
1866
9d1e68d557bf fix pylint error '(bad-except-order) Bad except clauses order (X is an ancestor class of Y)'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1865
diff changeset
   281
    enable=$enable,E0701          # (bad-except-order) Bad except clauses order (X is an ancestor class of Y)
1867
418777c1fbc7 fix pylint error "(no-name-in-module) No name 'X' in module 'Y'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1866
diff changeset
   282
    enable=$enable,E0611          # (no-name-in-module) No name 'X' in module 'Y'
1868
616c3f4bcbcb fix pylint error '(no-self-argument) Method should have "self" as first argument'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1867
diff changeset
   283
    enable=$enable,E0213          # (no-self-argument) Method should have "self" as first argument
1869
49cdd843c006 fix pylint error '(import-error) Unable to import X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1868
diff changeset
   284
    enable=$enable,E0401          # (import-error) Unable to import 'X'
1870
4d070115b552 fix pylint error '(too-many-function-args) Too many positional arguments for function call'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1869
diff changeset
   285
    enable=$enable,E1121          # (too-many-function-args) Too many positional arguments for function call
1872
866fb3ab8778 fix pylint error "(undefined-variable) Undefined variable 'X'"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1870
diff changeset
   286
    enable=$enable,E0602          # (undefined-variable) Undefined variable 'X'
1873
e69d7e5aff00 fix pylint warning '(no-init) Class has no __init__ method'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1872
diff changeset
   287
    enable=$enable,W0232          # (no-init) Class has no __init__ method
1875
62aaabbf8812 fix pylint warning '(redefine-in-handler) Redefining name 'X' from outer scope (line Y) in exception handler'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1873
diff changeset
   288
    enable=$enable,W0233          # (non-parent-init-called) __init__ method from a non direct base class 'X' is called
62aaabbf8812 fix pylint warning '(redefine-in-handler) Redefining name 'X' from outer scope (line Y) in exception handler'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1873
diff changeset
   289
    enable=$enable,W0601          # (global-variable-undefined) Global variable 'X' undefined at the module level
62aaabbf8812 fix pylint warning '(redefine-in-handler) Redefining name 'X' from outer scope (line Y) in exception handler'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1873
diff changeset
   290
    enable=$enable,W0623          # (redefine-in-handler) Redefining name 'X' from outer scope (line Y) in exception handler
1878
fb73a6b6622d fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1876
diff changeset
   291
    enable=$enable,W0106          # (expression-not-assigned) Expression "X" is assigned to nothing
fb73a6b6622d fix pylint warning '(bad-continuation) Wrong hanging indentation before block'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1876
diff changeset
   292
    enable=$enable,C0330          # (bad-continuation) Wrong hanging indentation before block
1879
4d81c3bcac82 fix pylint error '(unsubscriptable-object) Value 'X' is unsubscriptable'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1878
diff changeset
   293
    enable=$enable,E1136          # (unsubscriptable-object) Value 'X' is unsubscriptable
1881
091005ec69c4 fix pylint py3k conversion warning: "(no-absolute-import) import missing `from __future__ import absolute_import`"
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1879
diff changeset
   294
    enable=$enable,W1618          # (no-absolute-import) import missing `from __future__ import absolute_import`
1828
396da88d7b5c fix unnecessary parens after keyword
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1827
diff changeset
   295
    # enable=
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   296
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   297
    options=
1827
b8b47f9b5e56 enable pylint checker
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1786
diff changeset
   298
    options="$options --rcfile=.pylint"
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   299
    # options="$options --py3k"   # report errors for Python 3 porting
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   300
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   301
    if [ -n "$enable" ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   302
        options="$options --disable=all"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   303
        options="$options --enable=$enable"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   304
    else
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   305
        options="$options --disable=$disable"
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   306
    fi
1827
b8b47f9b5e56 enable pylint checker
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1786
diff changeset
   307
    # echo $options
b8b47f9b5e56 enable pylint checker
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1786
diff changeset
   308
b8b47f9b5e56 enable pylint checker
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1786
diff changeset
   309
    find ./ -name '*.py' | grep -v '/build/' | xargs pylint $options 
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   310
    if [ $? -ne 0 ]; then
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   311
        set_exit_error
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   312
    fi
2016
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   313
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   314
    echo "DONE"
2a8cd24a14ca Print version information about software used for tests
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1881
diff changeset
   315
    echo ""
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   316
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   317
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   318
main()
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   319
{
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   320
    compile_checks
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   321
    pep8_checks_default
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   322
    # pep8_checks_selected
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   323
    # flake8_checks
1827
b8b47f9b5e56 enable pylint checker
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 1786
diff changeset
   324
    pylint_checks
1786
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   325
    exit $exit_code
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   326
}
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   327
b6d47158d68a add shell script to test Beremiz python code
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents:
diff changeset
   328
main