Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small fixes to boilerplate and integration test scripts #3212

Merged
merged 2 commits into from
Oct 17, 2018

Conversation

balopat
Copy link
Contributor

@balopat balopat commented Oct 4, 2018

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 4, 2018
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 4, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: balopat

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 4, 2018
@balopat balopat mentioned this pull request Oct 4, 2018
# limitations under the License.

rootDir=$1
[[ "$rootDir" == "" ]] && export rootDir=`pwd`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything exported should be in all caps: ROOT_DIR

Context: https://google.github.io/styleguide/shell.xml?showone=Constants_and_Environment_Variable_Names#Constants_and_Environment_Variable_Names

Also, here's a handy short cut for setting default shell values:

readonly ROOT_DIR=${$1:-$(pwd)}
export ROOT_DIR

[[ "$rootDir" == "" ]] && export rootDir=`pwd`

function prepend() {
ignore="vendor\|\_gopath\|assets.go"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pattern=$1
ref=$2
headers=$3
files=`hack/boilerplate/boilerplate.py --rootdir $rootDir | grep -v "$ignore" | grep "$pattern"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

files=`hack/boilerplate/boilerplate.py --rootdir $rootDir | grep -v "$ignore" | grep "$pattern"`
for f in $files; do
echo $f;
copyright="$(cat hack/boilerplate/boilerplate.$ref.txt | sed s/YEAR/2018/g)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set copyright as local.

Move 2018 to a readonly constant.

echo $f;
copyright="$(cat hack/boilerplate/boilerplate.$ref.txt | sed s/YEAR/2018/g)"

if [ "$headers" != "" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copyright="$(cat hack/boilerplate/boilerplate.$ref.txt | sed s/YEAR/2018/g)"

if [ "$headers" != "" ]; then
fileHeaders="$(cat $f | grep $headers)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lowercase with underscores rather than camel case. Also, use "local".


if [ "$fileHeaders" != "" ]; then
fileContent="$(cat $f | grep -v $headers)"
printf '%s\n\n%s\n%s\n' "$fileHeaders" "$copyright" "$fileContent" > $f ;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for semicolon. Single space before >.

@balopat
Copy link
Contributor Author

balopat commented Oct 16, 2018

@tstromberg PTAL.

@balopat balopat merged commit 64e1853 into kubernetes:master Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants