-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-style
executable file
·35 lines (29 loc) · 1.83 KB
/
check-style
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh
# Copyright 2018-2021 Mentor Graphics Corporation.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, see
# <https://www.gnu.org/licenses/>.
# Run coding style checks for Sourcery Builder, using external checker
# commands (pyflakes, pycodestyle, pylint3).
cd "$(dirname "$0")"
py_files=$(find sourcery -name '*.py' | sort)
pyflakes $py_files
# The disabled checks are those that are, empirically, unsuitable for
# Sourcery Builder (typically because of the size or complexity of
# some of the code). Note that pycodestyle --ignore= means that only
# those checks are disabled, so some disabled-by-default checks may
# thereby be enabled. A few pylint checks that seem appropriate
# generally but inappropriate in particular cases are disabled with
# "pylint: disable=" comments within the source. It is possible that,
# as the code grows, more checks should be added to the set disabled
# here.
pycodestyle --ignore=E126,E129,W503 $py_files
pylint3 -j0 --persistent=n --disable=too-many-arguments,too-many-locals,too-few-public-methods,too-many-instance-attributes,too-many-branches,no-else-return,no-else-raise,too-many-statements,bad-continuation,duplicate-code,protected-access,too-many-public-methods,too-many-lines,consider-using-f-string --method-rgx='[a-z_][a-z0-9_]{2,60}$' $py_files