Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
340a99c3
Commit
340a99c3
authored
Jul 19, 2015
by
Eric Paris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use hack/verify-boilerplate.sh in pre-commit hook
Using the hack/ version is probably a little slower, but it still only takes about .2 seconds. So probably worth the reduction in code.
parent
72db1230
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
22 deletions
+4
-22
pre-commit
hooks/pre-commit
+4
-22
No files found.
hooks/pre-commit
View file @
340a99c3
...
@@ -41,31 +41,13 @@ fi
...
@@ -41,31 +41,13 @@ fi
echo
"
${
reset
}
"
echo
"
${
reset
}
"
echo
-ne
"Checking for files that need boilerplate... "
echo
-ne
"Checking for files that need boilerplate... "
files_need_boilerplate
=()
out
=(
$(
hack/verify-boilerplate.sh
)
)
boiler
=
"
${
KUBE_HOOKS_DIR
}
/boilerplate.py"
if
[[
$?
-ne
0
]]
;
then
# Check for go files without the required boilerplate.
if
[[
${#
files
[@]
}
-gt
0
]]
;
then
files_need_boilerplate+
=(
$(
"
${
boiler
}
"
"go"
"
${
files
[@]
}
"
)
)
fi
# Check for sh files without the required boilerplate.
files
=(
$(
git diff
--cached
--name-only
--diff-filter
ACM |
grep
"
\.
sh"
|
grep
-v
-e
"third_party"
-e
"Godeps"
)
)
if
[[
${#
files
[@]
}
-gt
0
]]
;
then
files_need_boilerplate+
=(
$(
"
${
boiler
}
"
"sh"
"
${
files
[@]
}
"
)
)
fi
# Check for py files without the required boilerplate.
files
=(
$(
git diff
--cached
--name-only
--diff-filter
ACM |
grep
"
\.
py"
|
grep
-v
-e
"third_party"
-e
"Godeps"
)
)
if
[[
${#
files
}
-gt
0
]]
;
then
files_need_boilerplate+
=(
$(
"
${
boiler
}
"
"py"
"
${
files
[@]
}
"
)
)
fi
if
[[
"
${#
files_need_boilerplate
[@]
}
"
-ne
0
]]
;
then
echo
"
${
red
}
ERROR!"
echo
"
${
red
}
ERROR!"
echo
"Some files are missing the required boilerplate header"
echo
"Some files are missing the required boilerplate header"
echo
"from hooks/boilerplate.txt:"
echo
"from hooks/boilerplate.txt:"
for
f
ile
in
"
${
files_need_boilerplate
[@]
}
"
;
do
for
f
in
"
${
out
[@]
}
"
;
do
echo
"
${
f
ile
}
"
echo
"
${
f
}
"
done
done
exit_code
=
1
exit_code
=
1
else
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment