Skip to content

Commit 2c69996

Browse files
committed
Remove redundant year flag (-y)
With the new copyright year logic, the year override is almost never used. When it is (for files which haven't yet been committed), the current year should be fine.
1 parent 6c9ae3b commit 2c69996

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

wpiformat/test/test_licenseupdate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def __exit__(self, type, value, traceback):
2727
def test_licenseupdate():
2828
year = str(date.today().year)
2929

30-
task = LicenseUpdate(year)
30+
task = LicenseUpdate()
3131
test = TaskTest(task)
3232

3333
file_appendix = \

wpiformat/wpiformat/__init__.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python3
22

33
import argparse
4-
from datetime import date
54
import math
65
import multiprocessing as mp
76
import os
@@ -235,13 +234,6 @@ def main():
235234
type=int,
236235
default=mp.cpu_count(),
237236
help="number of jobs to run (default is number of cores)")
238-
parser.add_argument(
239-
"-y",
240-
dest="year",
241-
type=int,
242-
default=date.today().year,
243-
help=
244-
"year to use when updating license headers (default is current year)")
245237
parser.add_argument(
246238
"-clang",
247239
dest="clang_version",
@@ -352,7 +344,7 @@ def main():
352344
BraceComment(),
353345
CIdentList(),
354346
IncludeGuard(),
355-
LicenseUpdate(str(args.year)),
347+
LicenseUpdate(),
356348
JavaClass(),
357349
Newline(),
358350
Stdlib(),

wpiformat/wpiformat/licenseupdate.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""This task updates the license header at the top of the file."""
22

3+
from datetime import date
34
import os
45
import regex
56
import subprocess
@@ -11,16 +12,6 @@
1112

1213
class LicenseUpdate(Task):
1314

14-
def __init__(self, current_year):
15-
"""Constructor for LicenseUpdate task.
16-
17-
Keyword arguments:
18-
current_year -- year string
19-
"""
20-
Task.__init__(self)
21-
22-
self.__current_year = current_year
23-
2415
def should_process_file(self, config_file, name):
2516
license_regex = config_file.regex("licenseUpdateExclude")
2617

@@ -150,7 +141,7 @@ def run_pipeline(self, config_file, name, lines):
150141
# If file hasn't been committed yet, use current calendar year as end of
151142
# copyright year range
152143
if last_year == "":
153-
last_year = self.__current_year
144+
last_year = str(date.today().year)
154145

155146
success, first_year, appendix = self.__try_regex(
156147
lines, last_year, license_template)

0 commit comments

Comments
 (0)