2 # Copyright 2008 the Melange authors.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Set some environmental variables for pylint and run it on Melange code
17 # To disable some of the checks use options listed below:
18 # disable unused imports: --disable-msg=W0611
19 # disable TODO: --disable-msg=W0511
20 # disable cyclic imports: --disable-msg=R0401
21 # disable report: --reports=no
22 # disable similarity check: --disable-checker=similarities
24 # Checks listed above are disabled in silent mode
25 # which can be run using --silent argument
30 if [ "$1" == "--silent" ]; then
31 SILENT_ARGS
="--disable-msg=W0511,R0401 --reports=no --disable-checker=similarities"
35 PROJ_DIR
=$
(dirname "$0")/..
/..
36 PROJ_DIR
=$
(cd "$PROJ_DIR"; pwd)
37 APP_DIR
="${PROJ_DIR}/app"
39 # Note: We will add ghop and gsoc modules once there something in there
40 CHECK_MODULES
="soc reflistprop settings.py urls.py main.py"
42 PYLINTRC
=$
(dirname "$0")/pylintrc
43 PYTHONPATH
="${PYTHONPATH}:${PROJ_DIR}/app/:${PROJ_DIR}/thirdparty/google_appengine/"
48 PYLINT_PATH
=$
(which pylint
)
50 if [ "$PYLINT_PATH" = "" ]; then
51 echo >&2 "Cannot find pylint. Make sure pylint is in your PATH variable."
55 CHECK_MODULES_PATHS
=""
57 for x
in $CHECK_MODULES
59 CHECK_MODULES_PATHS
="${CHECK_MODULES_PATHS} ${APP_DIR}/${x}"
62 pylint
$SILENT_ARGS $ARGS $CHECK_MODULES_PATHS