1#!/bin/bash 2# 3# Copyright 2021 Google Inc. All rights reserved. 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17set -e 18 19# HACKY solution to make nodejs work. 20source ~/.nvm/nvm.sh 21nvm alias default node 22nvm use default 23 24sh src/clang-format-git.sh 25 26# Check formatting for go lang 27 28cd go 29gofmt -w . 30cd .. 31cd grpc/examples/go 32sh format.sh 33cd ../../.. 34 35node_modules/.bin/eslint ts/** --ext .ts --quiet --fix 36 37#PYTHON IS DISABLED UNTIL WE CREATE A .pylintrc FILE FOR IT 38pylint python/** --disable=all 39 40swiftformat --config swift.swiftformat . 41 42 43if ! git diff --quiet; then 44 echo >&2 45 echo "ERROR: ********************************************************" >&2 46 echo "ERROR: The following differences were found after running" >&2 47 echo "ERROR: .travis/format_check.sh script. Maybe you forgot to format" >&2 48 echo "ERROR: the code after making changes? please check Formatters.md" >&2 49 echo "ERROR: ********************************************************" >&2 50 echo >&2 51 git diff --binary --exit-code 52fi