Back to home page

OSCL-LXR

 
 

    


0001 #!/usr/bin/env bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 
0020 set -o pipefail
0021 set -e
0022 
0023 SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
0024 SPARK_ROOT_DIR="$(dirname $SCRIPT_DIR)"
0025 LINT_R_REPORT_FILE_NAME="$SPARK_ROOT_DIR/dev/lint-r-report.log"
0026 
0027 
0028 if ! type "Rscript" > /dev/null; then
0029   echo "ERROR: You should install R"
0030   exit 1
0031 fi
0032 
0033 `which Rscript` --vanilla "$SPARK_ROOT_DIR/dev/lint-r.R" "$SPARK_ROOT_DIR" | tee "$LINT_R_REPORT_FILE_NAME"
0034 
0035 NUM_LINES=`wc -l < "$LINT_R_REPORT_FILE_NAME" | awk '{print $1}'`
0036 if [ "$NUM_LINES" = "0" ] ; then
0037   lint_status=0
0038   echo "lintr checks passed."
0039 else
0040   lint_status=1
0041   echo "lintr checks failed."
0042 fi
0043 
0044 exit "$lint_status"