#!/bin/bash # Copyright 2014 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." global boilerDir := ""$(KUBE_ROOT)/hack/boilerplate"" global boiler := ""$(boilerDir)/boilerplate.py"" global files_need_boilerplate := '('$(${boiler} "$@")) # Run boilerplate check if [[ ${#files_need_boilerplate[@]} -gt 0 ]] { for file in [$(files_need_boilerplate[@])] { echo "Boilerplate header is wrong for: $(file)" } exit 1 } (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [64 72] ) (/..) } spids: [63] ) ] spids: [63] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:boilerDir) op: Equal rhs: {(DQ (${ VSub_Name KUBE_ROOT) (/hack/boilerplate))} spids: [76] ) ] spids: [76] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:boiler) op: Equal rhs: {(DQ (${ VSub_Name boilerDir) (/boilerplate.py))} spids: [84] ) ] spids: [84] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:files_need_boilerplate) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [(C {(${ VSub_Name boiler)} {(DQ ($ VSub_At "$@"))})] ) left_token: spids: [95 103] ) } ] ) } spids: [93] ) ] spids: [93] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_gt left: { (BracedVarSub token: prefix_op: VSub_Pound bracket_op: (WholeArray op_id:Lit_At) spids: [114 120] ) } right: {(0)} ) ) terminator: ) ] action: [ (ForEach iter_name: file iter_words: [ { (DQ (BracedVarSub token: bracket_op: (WholeArray op_id:Lit_At) spids: [139 144] ) ) } ] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {(DQ ("Boilerplate header is wrong for: ") (${ VSub_Name file))}) ] spids: [148 161] ) spids: [137 146] ) (C {(exit)} {(1)}) ] spids: [-1 129] ) ] spids: [-1 169] ) ] )