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
334c2fdc
Commit
334c2fdc
authored
Mar 07, 2018
by
fisherxu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto check the current year
parent
f196b7c7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
boilerplate.py
hack/boilerplate/boilerplate.py
+8
-2
No files found.
hack/boilerplate/boilerplate.py
View file @
334c2fdc
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
from
__future__
import
print_function
from
__future__
import
print_function
import
argparse
import
argparse
import
datetime
import
difflib
import
difflib
import
glob
import
glob
import
json
import
json
...
@@ -171,12 +172,17 @@ def get_files(extensions):
...
@@ -171,12 +172,17 @@ def get_files(extensions):
outfiles
.
append
(
pathname
)
outfiles
.
append
(
pathname
)
return
outfiles
return
outfiles
def
get_dates
():
years
=
datetime
.
datetime
.
now
()
.
year
return
'(
%
s)'
%
'|'
.
join
((
str
(
year
)
for
year
in
range
(
2014
,
years
+
1
)))
def
get_regexs
():
def
get_regexs
():
regexs
=
{}
regexs
=
{}
# Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
# Search for "YEAR" which exists in the boilerplate, but shouldn't in the real thing
regexs
[
"year"
]
=
re
.
compile
(
'YEAR'
)
regexs
[
"year"
]
=
re
.
compile
(
'YEAR'
)
# dates can be 2014, 2015, 2016, 2017, or 2018; company holder names can be anything
# get_dates return 2014, 2015, 2016, 2017, or 2018 until the current year as a regex like: "(2014|2015|2016|2017|2018)";
regexs
[
"date"
]
=
re
.
compile
(
'(2014|2015|2016|2017|2018)'
)
# company holder names can be anything
regexs
[
"date"
]
=
re
.
compile
(
get_dates
())
# strip // +build \n\n build constraints
# strip // +build \n\n build constraints
regexs
[
"go_build_constraints"
]
=
re
.
compile
(
r"^(// \+build.*\n)+\n"
,
re
.
MULTILINE
)
regexs
[
"go_build_constraints"
]
=
re
.
compile
(
r"^(// \+build.*\n)+\n"
,
re
.
MULTILINE
)
# strip #!.* from shell scripts
# strip #!.* from shell scripts
...
...
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